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

Cite Dataset - BibTeX - Firefox json error #6029

Closed
ahmahdy opened this issue Jul 17, 2019 · 5 comments
Closed

Cite Dataset - BibTeX - Firefox json error #6029

ahmahdy opened this issue Jul 17, 2019 · 5 comments
Assignees

Comments

@ahmahdy
Copy link

ahmahdy commented Jul 17, 2019

I encountered an error while clicking on BibTex under Cite Dataset through Firefox as below, It works fine on chrome or safari.

Error
Page: Dataset page "dataset.xhtml"
Action: Clicking button "Cite Dataset--->BibTeX"
Browser: Firefox 60.8.0esr (64-bit)
Dataverse: 4.10.1
Occurrence "Audience": Everyone
Error Message: "SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data"

Cite Dataset

json

@mheppler
Copy link
Contributor

I was able to replicate this in demo (v. 4.15.1), but should also note, that when clicking the "Raw Data" tab in the Firefox browser (see screenshot above), you get the same results you see in Chrome and Safari (see below).

Screen Shot 2019-07-17 at 2 29 04 PM

Maybe there is a clue in the response headers:

Connection: close
Content-Disposition: inline;filename=doi:10.70122/FK2/ZBYP3J.bib
Content-Security-Policy: default-src 'none' ; script-src resource:; 
Content-Type: application/json
Date: Wed, 17 Jul 2019 18:27:57 GMT
Transfer-Encoding: chunked

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.5
Connection: keep-alive
Content-Length: 608
Content-Type: application/x-www-form-urlencoded
Cookie: _saml_idp=aHR0cHM6Ly9mZWQuaHVpdC5oYXJ2YXJkLmVkdS9pZHAvc2hpYmJvbGV0aA%3D%3D; JSESSIONID=7555266c9fd694eb514aae9b22a8
DNT: 1
Host: demo.dataverse.org
Referer: https://demo.dataverse.org/dataset.xhtml?persistentId=doi:10.70122/FK2/ZBYP3J
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Firefox/60.0

@djbrooke
Copy link
Contributor

Thanks @ahmahdy and @mheppler, we'll get a fix for this in the next sprint for inclusion in a future release.

@pdurbin
Copy link
Member

pdurbin commented Jul 17, 2019

Content-Type: application/json

This is why. Dataverse is asserting that BibTex is JSON. I assume this should be text/plain or something. Not sure.

I'm going to guess that response.setContentType("application/json"); here is the line that controls it:

https://github.com/IQSS/dataverse/blob/v4.15.1/src/main/java/edu/harvard/iq/dataverse/FileDownloadServiceBean.java#L434

Heh, it looks like I added FIXME above it. 😄 I thought this bug looked familiar!

@ahmahdy
Copy link
Author

ahmahdy commented Jul 17, 2019

while searching I found that other people fixed this by saving the file with ANSI encoding instead of UTF8. I hope this helps.

@djbrooke djbrooke added the Small label Jul 24, 2019
@mheppler
Copy link
Contributor

mheppler commented Jul 25, 2019

Added response.setCharacterEncoding("windows-1252"); (ref) to FileDownloadServiceBean.java, but still seeing the syntax error in Firefox. Leaving for the actual Java developers.

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

No branches or pull requests

5 participants