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

adding fix to file name for download guestbook responses #10613

Merged

Conversation

stevenwinship
Copy link
Contributor

When using the Chrome browser to download the guestbook of a Dataverse collection that has a comma in the collection's name, such as the collection named "Representation, Treatment, Outcome" the file name is truncated to Representation.

Closes #9401

Special notes for your reviewer:

Suggestions on how to test this: test by creating a collection with commas in the name and setting up guestbook. Then, download using Chrome, Safari, and Firefox.

Does this PR introduce a user interface change? If mockups are available, please link/include them here: No

Is there a release notes update needed for this change?: No

Additional documentation: Also removes other chars that could cause issues when used in a file name.

@stevenwinship stevenwinship added Type: Bug a defect Feature: Guestbook Size: 3 A percentage of a sprint. 2.1 hours. labels Jun 5, 2024
@stevenwinship stevenwinship self-assigned this Jun 5, 2024
@coveralls
Copy link

Coverage Status

coverage: 20.573%. remained the same
when pulling 4050375 on 9401-fix-truncated-collection-name-guestbook-csv-file
into 3c55c3f on develop.

This comment has been minimized.

@stevenwinship stevenwinship removed their assignment Jun 5, 2024
Copy link
Member

@pdurbin pdurbin left a comment

Choose a reason for hiding this comment

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

I took a quick look.

@@ -220,7 +220,8 @@ private String getFileName(){
// The fix below replaces any spaces in the name of the dataverse with underscores;
// without it, the filename was chopped off (by the browser??), and the user
// was getting the file name "Foo", instead of "Foo and Bar in Social Sciences.csv". -- L.A.
return dataverse.getName().replace(' ', '_') + "_GuestbookReponses.csv";
// Also removing some chars that have been reported to cause issues with certain browsers
return dataverse.getName().replace(' ', '_').replaceAll("[\\\\/:*?\"<>|,;]", "") + "_GuestbookResponses.csv";
Copy link
Member

Choose a reason for hiding this comment

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

Since these two regex's are the same, should they be defined once as a constant?

Also, can we have some tests?

Copy link
Contributor Author

@stevenwinship stevenwinship Jun 5, 2024

Choose a reason for hiding this comment

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

They're in 2 different classes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And neither of these classes have any tests :(

Copy link
Contributor Author

Choose a reason for hiding this comment

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

moving this method to FileUtil and adding tests

Copy link
Member

Choose a reason for hiding this comment

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

So much more readable! Thanks!

@coveralls
Copy link

Coverage Status

coverage: 20.574% (+0.001%) from 20.573%
when pulling 88877a4 on 9401-fix-truncated-collection-name-guestbook-csv-file
into 3c55c3f on develop.

Copy link

github-actions bot commented Jun 5, 2024

📦 Pushed preview images as

ghcr.io/gdcc/dataverse:9401-fix-truncated-collection-name-guestbook-csv-file
ghcr.io/gdcc/configbaker:9401-fix-truncated-collection-name-guestbook-csv-file

🚢 See on GHCR. Use by referencing with full name as printed above, mind the registry name.

Copy link
Member

@qqmyers qqmyers left a comment

Choose a reason for hiding this comment

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

Looks good. Earlier comments were addressed.

@sekmiller sekmiller self-assigned this Jul 8, 2024
@sekmiller sekmiller merged commit a466c97 into develop Jul 8, 2024
19 checks passed
@sekmiller sekmiller deleted the 9401-fix-truncated-collection-name-guestbook-csv-file branch July 8, 2024 19:52
@pdurbin pdurbin added this to the 6.4 milestone Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature: Guestbook Size: 3 A percentage of a sprint. 2.1 hours. Type: Bug a defect
Projects
None yet
5 participants