Skip to content

Conversation

@CGDogan
Copy link
Contributor

@CGDogan CGDogan commented Jun 22, 2023

Currently, when a user tries to upload a filename such as “slide(1).svs”, Slideloader will save it as “slide1.svs” and tell the frontend about this. This happens when finalizing an upload. However the frontend discards this information and after finalizing, validates by calling the metadata API of “slide(1).svs”, which returns “Not found”, and the user never reaches the “success” stage.

Summary

Firstly, the frontend should display the sanitized filename on upload finalization, and use this filename for validation.

Secondly, the frontend should also replace the filename with the sanitized one when starting upload.

Doing these both will give us good UX so that we won’t need to list: “the filename cannot contain (,), … etc”, but the user’s entered input will have these removed automatically and the user will understand instinctively that some characters aren’t allowed and will be removed.

Motivation

Many filenames have special characters and this needs to be handled correctly

Testing

I tested this patch with the following:
Filename with no special chars
Filename with ( or any other char
Filename with # (because this would be a special case if treated as a part of a URL)
The previous two cases, but now the user added the special chars after the original filename didn’t have them
Again, this time the user readded them after initial sanitizing
Filename with only special chars and extension
The previous but the user made it so after choosing a valid filenamed upload
Filename whose sanitization leads to conflict with a previous one
The previous but the original filename wouldn’t

Questions

Say an a.svs file already exists. The user would like to upload a.Svs. caMicroscope will replace the textbox with a.svs and say: "a.svs already exists!" The user then thinks, "No, I really want a.Svs and this is a different file!" The frontend same-query filtering will not show and error message or generate requests and the user won't proceed until he picks a different filename. In short, I thought it's best to not allow redundant queries to the backend in this case, since people, most likely those who would like to explor edge cases of caMicroscope, who would like to upload a.svs a.Svs a.SvS a.sVs a.sVS ... as different files are rare.

EDIT: I have now also added the patch for the batch loader

CGDogan added 3 commits June 21, 2023 20:30
Ran are: "headers are ok" and message content extraction. Run validation after the latter since this does not change behavior but we know the accepted file name only after this part, otherwise we have a race condition
@birm birm merged commit 78a679d into camicroscope:develop Aug 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants