Skip to content

Workspace name input does not trim leading/trailing whitespace #17

Closed

Description

@r3Fuze

In the initial workspace setup and in the workspace settings, when setting/changing the name of the workspace, you're allowed to have leading/trailing white space.

In my case I tried using a 2 character long workspace name (example: ab), but got stopped by the 4 character minimum. For fun I tried adding two spaces after the name to reach the 4 character minimum (eg. ab ) and was surprised that it worked. It works exactly the same when changing the name in the workspace settings.

Having invisible characters in the name (the spaces are removed in for example the user dropdown in the navbar) can be confusing, and is probably not intended.

Activity

  1. Philipinho commented on Jun 30, 2024

    @Philipinho
    Member

    Thank you for catching this. I will fix it.

  2. ellieschieder commented on Jun 30, 2024

    @ellieschieder

    I currently look into this (e.g. where this is the case.)

    Using string transforms:

    const formSchema = z.object({
      name: z.string().trim().min(2),
      password: z.string().trim().min(8),
    });

    Instead of using them just as z.string().min(2) https://zod.dev/?id=strings

    Also -> Names (first names) with just 1 char are relatively common. So if I'm allowed to trim every field and set names to min 1, I would be happy to send a PR.

  3. Philipinho commented on Jun 30, 2024

    @Philipinho
    Member

    @ellieschieder, I am happy to review your PR.

    You can set the minimum user name value to 1. It seems reasonable.

    These two backend validations will need to be updated too.

    (Your changes will also help to fix the length discrepancy here. I just noticed.)

    Just a heads-up, CLA is required when you send a PR, if that is okay with you.
    Thank you.

  4. ellieschieder commented on Jun 30, 2024

    @ellieschieder

    Thanks, the server side validation is what I in fact did not find so easy.

    I also did set (extra commit) theme per default to auto. I hope that is okay.

  5. ellieschieder commented on Jun 30, 2024

    @ellieschieder

    Ohhh also, I never worked with nextjs, where do I find the logic, that would allow me to also trim server side?

  6. ellieschieder commented on Jun 30, 2024

    @ellieschieder

    Nest/Fastify, sorry.

  7. Philipinho commented on Jun 30, 2024

    @Philipinho
    Member

    I would prefer the default theme to be light since there is a theme preference in settings. I like the bright colors first 😃

    You can find both DTO files in /apps/server/src/core/auth/dto.

    create-admin-user.dto.ts
    create-user.dto.ts
    

    Feel free to ask me any questions.

  8. ellieschieder commented on Jun 30, 2024

    @ellieschieder
  9. olivierIllogika commented on Jul 19, 2024

    @olivierIllogika
    Contributor

    @ellieschieder, I am happy to review your PR.

    You can set the minimum user name value to 1. It seems reasonable.

    These two backend validations will need to be updated too.

    (Your changes will also help to fix the length discrepancy here. I just noticed.)

    Just a heads-up, CLA is required when you send a PR, if that is okay with you. Thank you.

    Would creating a local file system package imported by both client and server, maybe called shared-constants, be a reasonable long term solution to this (and future possible) discrepancy?

  10. Philipinho commented on Oct 12, 2024

    @Philipinho
    Member

    Should be fixed here #397.

  11. added a commit that references this issue on Jun 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions