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

Stop gt 255 filenames breaking export #530

Conversation

cziaarm
Copy link
Contributor

@cziaarm cziaarm commented May 23, 2022

Conditionally truncate filenames to stop them going going over 255 chars when they have fileset_ids prepended to them.

Comment on lines +52 to +53
filename = "#{fn}.#{mime.to_sym}"
filename = fn if mime.to_s == ext_mime.to_s
Copy link
Contributor

Choose a reason for hiding this comment

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

why'd you swap these two lines?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

previously those lines explicitly returned the file name. As we're not returning but setting the filename var to use in the string that gets returned at the end, I needed to swap them round so it will set #{fn}.#{mime,to_sym} everytime and then reset just fn only if the condition is met. There are probably otherways to achieve the same thing, but that's the way I did it.

Comment on lines +55 to +56
filename = "#{file_set.id}_#{fn}.#{mime.to_sym}"
filename = "#{file_set.id}_#{fn}" if mime.to_s == ext_mime.to_s
Copy link
Contributor

Choose a reason for hiding this comment

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

same question here as the above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

same answer

@cziaarm
Copy link
Contributor Author

cziaarm commented May 23, 2022

I don't have perms to add a label, which is the only failing check left

@kirkkwang
Copy link
Contributor

I don't have perms to add a label, which is the only failing check left

I can add it for you, which label?

@cziaarm
Copy link
Contributor Author

cziaarm commented May 23, 2022

Thanks Kirk, I was thinking bug-fix?

@alishaevn alishaevn merged commit 7b058cc into samvera:main May 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants