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

PDFs uploaded to docdrop are saving wrong URL, but rel=canonical seems to be correct #1360

Open
mkdir-washington-edu opened this issue May 13, 2022 · 2 comments
Labels

Comments

@mkdir-washington-edu
Copy link

mkdir-washington-edu commented May 13, 2022

Related

EPUBS

Related to #1356

Related to #709

PDFs

Related to #1358

Related to #1360

Bug report form

Steps to reproduce

  1. Upload a PDF to https://docdrop.org
  2. Create an annotation
  3. Note the unexpected URL. It appears on the Activity Page, in share links, and in the target_uri for the annotation in the database

Expected behaviour

As an example, I uploaded and annotated https://docdrop.org/**pdf**/xample-v8554.pdf/.

Actual behaviour

While https://docdrop.org/**pdf**/xample-v8554.pdf/ is available, the Hypothesis share link for that document is https://hyp.is/go?url=https%3A%2F%2Fdocdrop.org%2F**download_annotation_doc**%2Fxample-v8554.pdf&group=__world__.

The target_uri for anotation id='5b8b3b6e-d2db-11ec-b10d-af5cd583a9ba' is https://docdrop.org/**download_annotation_doc**/xample-v8554.pdf.

Using the "View annotations in context" button on the Activity Page brings you to https%3A%2F%2Fdocdrop.org%2Fdownload_annotation_doc%2Fxample-v8554.pdf#annotations:W4s7btLbEeyxDa9c1YOpug

Browser/system information

MacOS 11.6.5
Chrome 100

Additional details

rel="canonical" on docdrop page looks correct. I'm not sure what else can be causing this issue.

@robertknight
Copy link
Member

robertknight commented May 16, 2022

@mkdir-washington-edu - It looks like the PDF URLs in the issue got mangled.

<link rel=canonical> is not used in PDFs. The URL that is used with annotations is the one reported by PDFViewerApplication.url, which in turn comes from the originalUrl parameter passed to app.open in the code that loads the client. See https://github.com/hypothesis/via/blob/a108568001254028d5335efa89c3d1c866296925/via/static/js/pdfjs-init.js#L47.

@robertknight
Copy link
Member

I had a quick look at an old version of the client code from 2017 to see if <link rel=canonical> had been used in PDFs in the past, but it looks like we've always had entirely separate code paths for getting the URL and metadata in HTML vs PDF documents. Certainly nothing has changed recently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants