-
Notifications
You must be signed in to change notification settings - Fork 132
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
Capture attachment file names whose name exceeds 100 chars #2003
Conversation
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.
It generally looks good. I have a question though
onadata/libs/utils/logger_tools.py
Outdated
@@ -336,6 +336,10 @@ def save_attachments(xform, instance, media_files, remove_deleted_media=False): | |||
xform.instances_with_osm = True | |||
xform.save() | |||
filename = os.path.basename(f.name) | |||
# Validate Attachment file name length | |||
if len(filename) > 99: |
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.
Based on the error message, should the number in the condition be 100 instead of 99? At the moment, if the size of the filename is 100, the error message will be triggerd, no?
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.
Made the change
b41f0fc
to
8278680
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.
lgtm
db9e897
to
55e6720
Compare
onadata/libs/utils/logger_tools.py
Outdated
raise AttachmentNameError( | ||
_('Attachment file name exceeds 100 characters')) |
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.
Let's ensure this exception is caught and an appropriate status code is returned with the reason.
55e6720
to
055d7c5
Compare
055d7c5
to
f068dfa
Compare
f068dfa
to
f0fb07d
Compare
Changes / Features implemented
Steps taken to verify this change does what is intended
Closes #1939