-
Notifications
You must be signed in to change notification settings - Fork 67
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
ENH ensure file title constructed from original filename #633
ENH ensure file title constructed from original filename #633
Conversation
f11e062
to
70ad6c4
Compare
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.
Thanks for submitting this. Unfortunately I can see a few problems with this approach.
This approach relies on a non-existent field OriginalName
which only gets populated on file upload.
This means for any files created programatically the functionality won't work.
This also breaks the ability to remove the title to reset to the name of the file.
Please try again with an approach that:
- Doesn't add new db fields, but also doesn't rely on non-existent fields
- Works when creating files programatically
- Allows content authors to clear the title and have it reset to the file name
70ad6c4
to
eb47e40
Compare
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.
Excellent, thank you! Just a few small things to tidy up
How about this update? The issue is with the Upload class. Not sure what you mean by If CMS author clear the title and save, it will use the transformed file name to populate the title. |
eb47e40
to
9584c31
Compare
When I said "creating files programatically" I meant creating a file record directly in PHP, and setting its content via the PHP API - without any user interaction. This doesn't use |
Just letting CI run, and gonna test it locally. If it all passes, I'll be happy to merge. |
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.
Looks good, and works great locally. Thanks!
Description
When uploading a file that uses a characters other than English letters, the codebase is going to santise the file name and rename it, this going to change filename from
الطالب لعائلتك.docx
to something which features digital characters, for instance66b034bf7ca15.docx
. When theFile
object is saved, the new file name is used to populate theTitle
field.This PR is to ensure the
Title
field is populated from the original file nameالطالب لعائلتك.docx
instead of the new name66b034bf7ca15.docx
Manual testing steps
Issues
Pull request checklist