-
Notifications
You must be signed in to change notification settings - Fork 8
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
28 remote file upload #1139
28 remote file upload #1139
Conversation
render json: filetype_json | ||
rescue Hets::HetsError | ||
render json: {status: 415, message: 'Media Type not supported'}, | ||
status: 415 |
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.
Style/AlignHash: Align the elements of a hash literal if they span more than one line.
067546d
to
eee9475
Compare
when 'local' | ||
temp_file.original_filename | ||
when 'remote' | ||
remote_file_iri.split('/').last |
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.
What if the iri has a query string or ends on /
?
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.
- ends on
/
: we don't care assplit
will take care of this (a lone/
at the end will just be dropped) - contains query-string: i will fix that.
Entering the remote address |
In order to decide how the HTTP response of a Hets::Caller should be served, we'll use speaking constant names.
This adds a module-method on the Hets module to determine the filetype for a resource which responds to the versioned_iri method.
There are some strange lookup errors otherwise.
As only one of the two needs to be provided, we had to change the validations (and add a validation for the remote file iri). Additionally, as simple-form and html5 do not support conditionally required fields we shall not supply an option for that. Local file upload is marked as default for the radio-button mode
Currently an implementation of .retrieve, which will perform the fetching of the remote file, is still missing.
.original_filename only works for UploadFiles not for any other Tempfile (of course, as Tempfiles do not have an origin). So we'll need to refer to the iri instead. We'll just take the part after the last slash '/' as the filename.
We should make this job asynchronous later on. However for now synchronous is good enough.
The controllers only action (create/POST) will retrieve the filetype behind a given iri.
Provide filename suggestions if a filename has not been set and the url-filename does not contain a fileextension. Also provide suggestions if the filename that was set matches the one provided by a previous suggestion.
Conflicts: db/migrate/20141206163145_add_mappings_to_file_extension_mime_type_mappings.rb
as the remote-iri can contain a query-string, we will safely ignore the query-string part if it exists.
Mh i don't get the same issue. For me it suggests: |
eee9475
to
2ed5c2f
Compare
When I wrote the comment, it said |
👍 |
Should fix #28. Needs the current version of hets.