Content-Length: 277940 | pFad | https://github.com/internetarchive/openlibrary/pull/9158

33 Add whitespace validation for book titles by SivanC · Pull Request #9158 · internetarchive/openlibrary · GitHub
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

Add whitespace validation for book titles #9158

Conversation

SivanC
Copy link
Contributor

@SivanC SivanC commented Apr 25, 2024

Closes #9136

Fixes a bug where users were able to add books without titles by putting only whitespace characters into the required title field.

Technical

Adds a regex check in plugins/openlibrary/js/validate.js to the title class used by templates/books/add.html that ensures the title input contains at least one non-whitespace character.

Testing

  1. Go to the 'Add Book' page
  2. Attempt to add a book with a title containing only whitespace characters (i.e. matches /\s+/)
  3. Observe that the action is not successful and the title input box is red

Screenshot

image

Stakeholders

@cdrini

@cdrini cdrini self-assigned this Apr 26, 2024
@cdrini cdrini added the Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed] label Apr 26, 2024
@cdrini cdrini removed the Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed] label Apr 26, 2024
Copy link
Collaborator

@cdrini cdrini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm! Tested in gitpod and:

  • empty title errors
  • whitespace only title errors
  • non-whitespace title doesn't

@cdrini cdrini merged commit 6a1b173 into internetarchive:master Apr 26, 2024
3 checks passed
merwhite11 pushed a commit to merwhite11/openlibrary that referenced this pull request May 2, 2024
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 this pull request may close these issues.

Users are somehow creating books without titles
2 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/internetarchive/openlibrary/pull/9158

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy