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

filingCookie is undefined…breaks extension #371

Closed
johnhawkinson opened this issue Jun 20, 2024 · 3 comments · Fixed by freelawproject/recap-chrome#377
Closed

filingCookie is undefined…breaks extension #371

johnhawkinson opened this issue Jun 20, 2024 · 3 comments · Fixed by freelawproject/recap-chrome#377

Comments

@johnhawkinson
Copy link
Collaborator

johnhawkinson commented Jun 20, 2024

The extension seems to be currently broken for me, probably specific to my cookie configuration.
But it's also clear the code is broken. I get this error:

TypeError: filingCookie is undefined    pacer.js:609:13

which is from this code in pacer.js:

  // Given document.cookie, returns true if the user has filing rights.
  hasFilingCookie: function (cookieString){
    let filingCookie = cookieString.split('; ')
        .find((row) => row.startsWith('isFilingAccount'))
        ?.split('=')[1];
    return !!filingCookie.match(/true/);
  },

which fails to guard filingCookie before calling .match().

Prior to freelawproject/recap-chrome@e2a07cf (Fri Nov 18 20:26:39 2022 -0400) this code properly guarded filingCookie before match().

-    return !!(filingCookie && filingCookie.match(/true/));

A similarly robust check should be applied here.

Not sure what the cookie pattern trigger is. I'll take my chocolate chips cooked on hot East Coat asphalt concrete with a few mirrors and maybe a lens, please.

@mlissner
Copy link
Member

Thanks John. Any idea why this isn't breaking the extension for more people (I don't have any other reports?)

@johnhawkinson
Copy link
Collaborator Author

Historically it has not broken it for me, so I'm sure it relates to the exact order of cookies that I have right now, and probably some other bug that relates to why I lack an isFilingAccount internal RECAP cookie, but disentagling that logic doesn't seem a good use of anyone's effort.

So, this probably only affects filing users and probably only somewhat randomly.

If it's helpful, here's the edited value of document.cookie (which is passed to hasFilingCookie by content_delegate.js) in my browser devtools from a page where RECAP is failing:

"_ga_CSLL4ZEK4L=redacted1; mpt_initial_referer=redacted2; _ga_83ZBSG354S=redacted3; KEY=redacted4" 

But really, I think, just fix the missing guard and move on?

@mlissner
Copy link
Member

Seems simple enough. Thanks, I'll put it on Eduardo's backlog once he finishes a couple other things that are high priority.

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

Successfully merging a pull request may close this issue.

2 participants