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

Clicking on a link creates 2 requests #234

Open
orjandh opened this issue Nov 24, 2022 · 3 comments
Open

Clicking on a link creates 2 requests #234

orjandh opened this issue Nov 24, 2022 · 3 comments

Comments

@orjandh
Copy link

orjandh commented Nov 24, 2022

Describe the bug
Clicking on a html anchor link in the "Message" view of a message sends 2 requests to the server.

To Reproduce
Steps to reproduce the behavior:

  1. Set up a HTTP server or use https://webhook.site/ to inspect incoming requests.
  2. Receive a message with the following text:
    <a href="{{link}}">{{link}}</a>
  3. Open the message in the "Message" viewer.
  4. Click the anchor to open link.
  5. Verify on server that 2 requests was sent.

Expected behavior
I expect there to only be 1 request when clicking a link.

Desktop (please complete the following information):

  • OS: Windows 11
  • Version 6.2.0

Additional context
Maybe the issue is that the request is already sent when the NavigationStarting event is fired, so cancelling this event only has effects on the UI.

As a side note, this does not happen if opening the link by pressing ctrl and clicking the link on the "Raw" or "Body" views in PaperCut.

@Jaben
Copy link
Member

Jaben commented Dec 14, 2022

I can't reproduce... Can you provide a screen shot of where you're seeing the multiple requests "on the server"?

Thanks.

@orjandh
Copy link
Author

orjandh commented Dec 14, 2022

I have updated the issue with more detailed instructions. This is an screenshot from the webhook.site service. (I discovered the problem using my own server, but using a third party now to verify). Also notice the same timestamp.

screenshot

@RickKukiela
Copy link

So this "bug" just cost me like 3 hours of dev time on a project because it was messing with my requests. The phantom first link was executing the action and then the 2nd real request would fail (rightfully) because the first "phantom" request already did the action the link that was "emailed" to me was supposed to do.

The trick to the bug and why some may not be able to reproduce it, it seems is a default browser configuration issue. If you use EDGE as your default browser, then it's likely that you cannot reproduce this bug.

My default browser is Chrome. When I click a link that was "emailed" to my papercut receptacle, I see two requests almost simulaniously on my server with two different user agents:

The first (phantom) request I get:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36 Edg/113.0.1774.42

The 2nd request which I see open in my chrome:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36

It seems like somehow papercut is trying to open the request in Edge, but my system knows chrome is my default browser so then it passes the "Job" to open the link to chrome, but never stops the Edge api from making the web request. It never actually creates an Edge window though, so you would never know this request was happening unless its messing with the secondary request being fulfilled by chrome by performing the action first breaking the action attempt for the chrome request.

I was only able to finally figure this out by putting a request logger directly in my app entry point...

At least I'm aware of this so I wont waste more time on this but this is a real gnarly bug.

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

No branches or pull requests

3 participants