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

Downloading a large vocabulary crashes the browser tab #901

Closed
kouralex opened this issue Nov 20, 2019 · 7 comments
Closed

Downloading a large vocabulary crashes the browser tab #901

kouralex opened this issue Nov 20, 2019 · 7 comments
Assignees
Milestone

Comments

@kouralex
Copy link
Contributor

At which URL did you encounter the problem?

http://finto.fi/rest/v1/yso/data?format=application/rdf%2Bxml

What steps will reproduce the problem?

  1. Go to http://finto.fi/yso/en
  2. Click the RDF/XML link at the Download this vocabulary as SKOS/RDF:

What is the expected output? What do you see instead?

I expect to download the vocabulary. Instead of that I get a crashed tab.

What browser did you use? (eg. Firefox, Chrome, Safari, Internet explorer)

Firefox

@kouralex kouralex added this to the Next Tasks milestone Nov 20, 2019
@kouralex
Copy link
Contributor Author

The issue seems to be related to the browser behavior: it tries to open the file in browser, crashing it.

I think it should suggest downloading the vocabulary instead of showing it. I am not sure if this is browser-related issue (do user preferences affect this?) or a general one. If there is a way to force the browser to ask what to do with the file, it should be implemented.

@osma
Copy link
Member

osma commented Nov 20, 2019

You can use a HTTP header (Content-Disposition) to indicate that a resource is intended to be downloaded, but this would have to be done in Apache (or whatever web server is used to serve the actual vocabulary files), outside Skosmos.

Another option is to use the download attribute on the link tag. This could be done in the Skosmos HTML template code, though I don't know if it's widely supported or not.

Source for both: https://www.designedbyaturtle.co.uk/how-to-force-the-download-of-a-file-with-http-headers-and-php/

@osma
Copy link
Member

osma commented Nov 20, 2019

I'm also unsure whether the download attribute plays well with the redirection that happens when you click the link.

@kouralex
Copy link
Contributor Author

Just checked, seems like the easy way of setting the download attribute does not play well with the redirection.

@osma
Copy link
Member

osma commented Dec 4, 2019

I added this snippet to the Apache VirtualHost configuration:

    # set Content-Disposition header for RDF and MARCXML downloads
    # so that browsers don't try to render them
    <IfModule mod_headers.c>
        <FilesMatch "\.(ttl|rdf|mrcx)$">
            Header set Content-Disposition "attachment"
        </FilesMatch>
    </IfModule>

Also, the headers Apache module needs to be enabled.

@kouralex
Copy link
Contributor Author

kouralex commented Dec 4, 2019

Ok, so this leaves open only the documentation part. Can you do that @osma (in addition to closing this)?

@osma osma removed their assignment Apr 30, 2020
@osma osma self-assigned this May 8, 2020
@osma
Copy link
Member

osma commented May 8, 2020

I added documentation about this to the Serving Linked Data wiki page:

https://github.com/NatLibFi/Skosmos/wiki/ServingLinkedData#serving-vocabulary-data-files

@osma osma modified the milestones: Next Tasks, 2.6 May 8, 2020
@osma osma closed this as completed May 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants