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

28 remote file upload #1139

Merged
merged 24 commits into from
Jan 29, 2015
Merged

28 remote file upload #1139

merged 24 commits into from
Jan 29, 2015

Conversation

0robustus1
Copy link
Contributor

Should fix #28. Needs the current version of hets.

render json: filetype_json
rescue Hets::HetsError
render json: {status: 415, message: 'Media Type not supported'},
status: 415

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.

@eugenk eugenk self-assigned this Jan 12, 2015
when 'local'
temp_file.original_filename
when 'remote'
remote_file_iri.split('/').last
Copy link
Member

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 /?

Copy link
Contributor Author

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 as split will take care of this (a lone / at the end will just be dropped)
  • contains query-string: i will fix that.

@eugenk
Copy link
Member

eugenk commented Jan 28, 2015

Entering the remote address https://ontohub.org/dol-examples/equiv into the form, I get the filename suggestion equivnull.

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.
@0robustus1
Copy link
Contributor Author

Mh i don't get the same issue. For me it suggests: equiv.het. Which isn't perfect either but it is what hets returns. Which version of hets are you using?
Could you check your network-communications and posts the javascript-call response to /filetypes here?

@eugenk
Copy link
Member

eugenk commented Jan 29, 2015

When I wrote the comment, it said text/plain (https://ontohub.org/dol-examples/equiv.dol: text/plain). Now it says text/het and the correct extension is suggested.
I don't know why it changed.

@eugenk
Copy link
Member

eugenk commented Jan 29, 2015

👍

0robustus1 added a commit that referenced this pull request Jan 29, 2015
@0robustus1 0robustus1 merged commit aa92655 into staging Jan 29, 2015
@0robustus1 0robustus1 deleted the 28-remote_file_upload branch January 29, 2015 13:11
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.

No filename extension appended to extension-less ontology files?
3 participants