client icon indicating copy to clipboard operation
client copied to clipboard

Creating annotation fails on Wired article due to URI decoding error

Open robertknight opened this issue 8 years ago • 3 comments

Update (2023-01-03): The original article is no longer available, but see https://github.com/hypothesis/client/issues/531#issuecomment-463611460 for a new set of steps to reproduce.


Original report:

Originally reported by @heatherstaines on Slack (https://hypothes-is.slack.com/archives/C2BLQDKHA/p1504357779000060)

  1. Go to https://www.wired.com/story/harvey-evacuees-leave-their-belongings-and-health-records-behind?mbid=nl_090117_daily&CNDID=%%CUST_ID%%
  2. Activate the Hypothesis extension
  3. Select some text and click "Annotate"

Expected: New annotation created Actual: No annotation created, console error:

Uncaught URIError: URI malformed
    at decodeURIComponent (<anonymous>)
    at eval (eval at module.exports.e.uri (injector.bundle.js?8a864f:formatted:6787), <anonymous>:1:1)
    at e.module.exports.e.uri (injector.bundle.js?8a864f:formatted:6787)
    at e.uri (injector.bundle.js?8a864f:formatted:6735)
    at e.module.exports.n.getDocumentInfo (injector.bundle.js?8a864f:formatted:5603)
    at e.module.exports.n.createAnnotation (injector.bundle.js?8a864f:formatted:5870)
    at Object.onAnnotate (injector.bundle.js?8a864f:formatted:5522)
    at HTMLButtonElement.n (injector.bundle.js?8a864f:formatted:3850)

The URI passed to decodeURIComponent is https://www.wired.com/story/harvey-evacuees-leave-their-belongings-and-health-records-behind?mbid=nl_090117_daily&CNDID=%%CUST_ID%%, note the placeholder at the end. Passing this to decodeURIComponent results in an error.

robertknight avatar Sep 02 '17 16:09 robertknight

Some additional context: The link came from an email that Wired sent out. The problematic part ('%%CUST_ID%%') is not part of the normal article link.

robertknight avatar Sep 03 '17 14:09 robertknight

However, I use the Wired emails as my primary entry point to read the articles, and I've not had this problem before. Heather

On Sun, Sep 3, 2017 at 10:47 AM, Robert Knight [email protected] wrote:

Some additional context: The link came from an email that Wired sent out. The problematic part ('%%CUST_ID%%') is not part of the normal article link.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/hypothesis/client/issues/531#issuecomment-326809425, or mute the thread https://github.com/notifications/unsubscribe-auth/AXoiF3V0OpTFKbTYfZNVSuMWZK_2HXNQks5serwLgaJpZM4PK8G0 .

-- Heather Ruland Staines Director, Partnerships Hypothes.is M: 203-400-1716 Skype: heather.staines

heatherstaines avatar Sep 04 '17 12:09 heatherstaines

The Wired article is completely failing to load for me. However it is possible to trigger an issue by inserting %%CUST_ID%% into an arbitrary URL.

Steps to reproduce

  1. Go to https://example.com/?foo=%%CUST_ID%%
  2. Activate the embed

Expected: Client loads and annotations can be created. Actual: JS error reported in console and sidebar remains stuck in a "loading" state.

robertknight avatar Feb 14 '19 12:02 robertknight

This has now been fixed. It can be tested by going to https://hypothes.is/docs/help?foo=%%CUST_ID%%, which embeds the latest version of the client.

This will be landing soon in the browser extension.

acelaya avatar Feb 23 '24 09:02 acelaya