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

(BUG) PDF attachments become difficult to access #191

Closed
2 tasks done
rdbell opened this issue Mar 30, 2024 · 1 comment
Closed
2 tasks done

(BUG) PDF attachments become difficult to access #191

rdbell opened this issue Mar 30, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@rdbell
Copy link

rdbell commented Mar 30, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Is This A Security Issue?

  • This is not a security issue

Describe The Problem

I'm able to attach a PDF file and add a link to it in my note, but it's difficult to access the file.

Clicking the link in my note (/api/notes/xxx/assets/xxx) produces a 200 response with Content-Type: text/html and renders a blank page.

Refreshing the page in Firefox and Chrome will continue to produce the same text/html response. A hard-refresh will bypass the browser cache and produce the appropriate Content-Type: application/pdf response. Accessing the attachment via curl also returns the correct Content-Type header.

Once the PDF is finally rendered in-browser (after hard-refresh), the browser's back button becomes non-functional and only adjusts the URL in the browser's URL bar but does not navigate away from the PDF.

This seems to be an issue with how the client-side code in the front-end web app renders responses returned by the backend server.

Expected Behavior

Accessing file attachments while navigating from the web app should produce proper Content-Type header responses.

Steps To Reproduce

  1. Create a note.
  2. Upload a PDF attachment for that note.
  3. Include a link to the attachment with relative path [file][/api/...] or absolute path [file][https://domain.com/api/...]
  4. Click the link.

Environment

  • Docker AIO through nginx reverse proxy
  • Docker AIO direct access

Extra Context

Cool project, thanks for building this.

I'm trying to deploy this for friends/family but the workarounds are not practical for non-technical users.

@rdbell rdbell added the bug Something isn't working label Mar 30, 2024
@enchant97
Copy link
Owner

Thanks for reporting! I can confirm this is not working as intended for both all-in-one and backend/frontend deployments.

enchant97 added a commit that referenced this issue Apr 13, 2024
caused by ServiceWorker caching the /api route, which should not happen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants