GlobalDataverseCommunityConsortium / dataverse-previewers

A collection of Datafile Previewers that can be configured to work with Dataverse
MIT License
13 stars 38 forks source link

remove trailing backslash from toolUrl values #59

Closed donsizemore closed 2 years ago

donsizemore commented 2 years ago

Closes #58

qqmyers commented 2 years ago

From our slack discussion, the root issue appears to be partly a github display issue - the raw file is consistently formatted (all double quotes escaped with a ), but github displays only the \ before the " at the end of the toolUrl value, presumably as part of recognizing the toolUrl value as a URL and turning it into a live link. The PR as is fixes the displayed file, so cut/paste works.

With some additional playing around, it looks like the following syntax would make both the display and raw file values cut/pastable. Not sure that's worth the effort so I'll document that here and go ahead and accept the PR.

curl -X POST -H 'Content-type: application/json' http://localhost:8080/api/admin/externalTools -d ' { "displayName":"Read Text", "description":"Read the text file.", "toolName":"textPreviewer", "scope":"file", "types":["preview"], "toolUrl":"https://globaldataversecommunityconsortium.github.io/dataverse-previewers/previewers/TextPreview.html", "toolParameters": { "queryParameters":[ {"fileid":"{fileId}"}, {"siteUrl":"{siteUrl}"}, {"key":"{apiToken}"}, {"datasetid":"{datasetId}"}, {"datasetversion":"{datasetVersion}"}, {"locale":"{localeCode}"} ] }, "contentType":"text/plain" }'