Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project Manager allows to add assets with new line characters #534

Open
BigRoy opened this issue Mar 13, 2020 · 3 comments · May be fixed by #543
Open

Project Manager allows to add assets with new line characters #534

BigRoy opened this issue Mar 13, 2020 · 3 comments · May be fixed by #543

Comments

@BigRoy
Copy link
Collaborator

BigRoy commented Mar 13, 2020

What happened?

Somehow it's possible to add/create a new Avalon asset using the project manager that includes a new line character \n. It somehow manages to pass validation.

What did you expect?

This should never get through.

To Reproduce

E.g. copy past the text below including the new line:

invalid

Note how you can create an asset using this.

Additional context

It should not pass the schema.validate check which it magically does. Trying to create a name with a space in it does get captured correctly, however the schema does not invalidate a new line.

It only passes if the new line is at the end of the string. Even adding a space after it makes it fail.

Below examples are written with the escape characters explicitly written, when entering these in the asset name field copy pasting won't reproduce the same behavior. \n must be a new line, \t must be a tab (not spaces).

This incorrrectly passes validation:
invalid\n

This is correctly disallowed:
invalid\n (note space after \n)
invalid\t
invalid\naa
\ninvalid
\tinvalid

I'm not sure why it allows the \n at the end of the name.

@davidlatwe
Copy link
Collaborator

We may add a QtGui.QRegExpValidator into the asset label QLineEdit widget just like the one in the Creator App here.

But might need to pop an error message to indicate invalid found, because I imaging one would copy/paste the asset name from somewhere else, and pasting string that contains invalid character did not ring any bell by default and leave a user with a confused face.

11d9268a-3562-445a-b636-13db4a5695d0

@davidlatwe
Copy link
Collaborator

Here's a quick implementation I made:

a0385362-5aa9-49e4-ae6b-ee3bb628c0cd

@BigRoy
Copy link
Collaborator Author

BigRoy commented Apr 22, 2020

Looking good. Is there any way to, e.g. on paste preserve all valid characters and just strip the invalid ones as opposed to pasting nothing at all?

@davidlatwe davidlatwe linked a pull request Apr 22, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants