-
Notifications
You must be signed in to change notification settings - Fork 522
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
AO3-6625 Replace whitespace in download filenames with underscores #4645
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
AO3-6625 Don't include whitespace in download filenames
commit afdf8e1e4c3a7d247631afae83b6ec4520c3e402
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,36 +13,36 @@ | |
|
||
# Arabic | ||
work.title = "هذا عمل جديد" | ||
expect(Download.new(work).file_name).to eq("hdh ml jdyd") | ||
expect(Download.new(work).file_name).to eq("hdh_ml_jdyd") | ||
|
||
# Chinese | ||
work.title = "我哥好像被奇怪的人盯上了怎么破" | ||
expect(Download.new(work).file_name).to eq("Wo Ge Hao Xiang Bei Qi") | ||
expect(Download.new(work).file_name).to eq("Wo_Ge_Hao_Xiang_Bei_Qi") | ||
|
||
# Japanese | ||
work.title = "二重スパイは接点を持つ" | ||
expect(Download.new(work).file_name).to eq("Er Zhong supaihaJie Dian") | ||
expect(Download.new(work).file_name).to eq("Er_Zhong_supaihaJie_Dian") | ||
|
||
# Hebrew | ||
work.title = "לחזור הביתה" | ||
expect(Download.new(work).file_name).to eq("lkhzvr hbyth") | ||
expect(Download.new(work).file_name).to eq("lkhzvr_hbyth") | ||
end | ||
|
||
it "removes HTML entities and emojis" do | ||
work.title = "Two of Hearts <3 & >.< &" | ||
expect(Download.new(work).file_name).to eq("Two of Hearts 3") | ||
expect(Download.new(work).file_name).to eq("Two_of_Hearts_3") | ||
|
||
work.title = "Emjoi 🤩 Yay 🥳" | ||
expect(Download.new(work).file_name).to eq("Emjoi Yay") | ||
expect(Download.new(work).file_name).to eq("Emjoi_Yay") | ||
end | ||
|
||
it "appends work ID if too short" do | ||
work.id = 999_999 | ||
work.title = "Uh" | ||
expect(Download.new(work).file_name).to eq("Uh Work 999999") | ||
expect(Download.new(work).file_name).to eq("Uh_Work_999999") | ||
|
||
work.title = "" | ||
expect(Download.new(work).file_name).to eq("Work 999999") | ||
expect(Download.new(work).file_name).to eq("Work_999999") | ||
|
||
work.title = "wat" | ||
expect(Download.new(work).file_name).to eq("wat") | ||
|
@@ -53,7 +53,7 @@ | |
expect(Download.new(work).file_name).to eq("123456789-123456789-1234") | ||
|
||
work.title = "123456789 123456789 123456789" | ||
expect(Download.new(work).file_name).to eq("123456789 123456789") | ||
expect(Download.new(work).file_name).to eq("123456789_123456789") | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe an additional test for the edge case of a work title having several consecutive spaces like |
||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My JS-addled immediately thought of "simplifying" that using
join
:But not exactly sure this is indeed better.