hyrax
hyrax copied to clipboard
File Manager upload and sorting broken with relative_root_url option
Descriptive summary
The URL used to upload files to a work is not generated by Rails route and therefore does not respect URL builder configuration. Specifically: https://github.com/projecthydra-labs/hyrax/blob/master/app/assets/javascripts/hyrax/uploader.js#L34
Similarly, the persist function of SortManager constructs a URL for POSTing instead of using a Rails generated route which will respect URL builder configuration. The specific line of code in question is: https://github.com/projecthydra-labs/hyrax/blob/master/app/assets/javascripts/hyrax/file_manager/sorting.es6#L22
Rationale
Using the file manager to persist changes will break in an application that makes use of the relative_root_url Rails configuration option.
Steps to reproduce the behavior
- Configure the internal app to run from a relative url root
- Attempt to upload files to a work
- Or attempt to rearrange a work's existing files using the file manager
- Either method will fail with a 404 shown in the browser's dev tools
Related work
#136
#135