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

fix: LSDV-5096: Loading a pre-signed url with the new proxy urls in a new tab does not work #4194

Merged
merged 4 commits into from
Jun 19, 2023

Conversation

bmartel
Copy link
Contributor

@bmartel bmartel commented May 15, 2023

PR fulfills these requirements

  • Commit message(s) and PR title follows the format [fix|feat|ci|chore|doc]: TICKET-ID: Short description of change made ex. fix: DEV-XXXX: Removed inconsistent code usage causing intermittent errors
  • Tests for the changes have been added/updated (for bug fixes/features)
  • Docs have been added/updated (for bug fixes/features)
  • Best efforts were made to ensure docs/code are concise and coherent (checked for spelling/grammatical errors, commented out code, debug logs etc.)
  • Self-reviewed and ran all changes on a local instance (for bug fixes/features)

Change has impacts in these area(s)

(check all that apply)

  • Product design
  • Backend (Database)
  • Backend (API)
  • Frontend

Describe the reason for change

When loading a url in a new tab, ie. Right-click and opening an image in a new tab, when using cloud storage and presigned urls does not work correctly.

What does this fix?

When accessing a proxy pre-signed url directly, by either entering this url into an address bar or opening an image into a new tab, this will work without the service worker and fixes weird behaviours where the redirect doesn't work within this scope, as the page itself is not actually a view or anything we are directly serving so the service worker can sometimes fail to serve anything which seems to be the case more often than not. Locally I could get this to eventually resolve but deployments of label-studio were consistently failing.

What is the new behavior?

Don't cache redirects for proxy pre-sign urls that are navigated directly to (ie. another tab with the url placed into it, or a new tab opened directly from an image resource).

What is the current behavior?

Cache all on domain requests to presign.

What libraries were added/updated?

None.

Does this change affect performance?

No, this just ensures there is appropriate handling for this case and this does mean it will actively resolve the url but overall that will not create a large issue as it is a one-off case to do this.

Does this change affect security?

No.

What alternative approaches were there?

N/A

What feature flags were used to cover this change?

fflag_fix_all_lsdv_4711_cors_errors_accessing_task_data_short

Does this PR introduce a breaking change?

(check only one)

  • Yes, and covered entirely by feature flag(s)
  • Yes, and covered partially by feature flag(s)
  • No
  • Not sure (briefly explain the situation below)

What level of testing was included in the change?

(check all that apply)

  • e2e
  • integration
  • unit

Which logical domain(s) does this change affect?

Presigned URLs, Cloud Storage

@netlify
Copy link

netlify bot commented May 15, 2023

Deploy Preview for label-studio-docs-new-theme canceled.

Name Link
🔨 Latest commit e50d883
🔍 Latest deploy log https://app.netlify.com/sites/label-studio-docs-new-theme/deploys/648c75506c2cad0008f27783

@netlify
Copy link

netlify bot commented May 15, 2023

Deploy Preview for heartex-docs canceled.

Name Link
🔨 Latest commit e50d883
🔍 Latest deploy log https://app.netlify.com/sites/heartex-docs/deploys/648c75507888230008ff8582

@github-actions github-actions bot added the fix label May 15, 2023
@codecov
Copy link

codecov bot commented May 15, 2023

Codecov Report

Patch coverage has no change and project coverage change: +0.41 🎉

Comparison is base (eecc005) 75.64% compared to head (feba3b3) 76.06%.

❗ Current head feba3b3 differs from pull request most recent head e50d883. Consider uploading reports for the commit e50d883 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4194      +/-   ##
===========================================
+ Coverage    75.64%   76.06%   +0.41%     
===========================================
  Files          156      156              
  Lines        12164    11893     -271     
===========================================
- Hits          9202     9046     -156     
+ Misses        2962     2847     -115     

see 26 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@bmartel
Copy link
Contributor Author

bmartel commented Jun 16, 2023

/git merge develop

Successfully pushed new changes:
Merge remote-tracking branch 'origin/develop' into fb-lsdv-5096 (88b362b)

Workflow run

@bmartel bmartel merged commit 1f6ea2f into develop Jun 19, 2023
28 of 37 checks passed
shayantabatabaee pushed a commit to shayantabatabaee/label-studio that referenced this pull request Sep 19, 2023
… new tab does not work (HumanSignal#4194)

* fix: LSDV-5096: Loading a pre-signed url with the new proxy urls in a new tab does not work

* check if referrer was empty to detect loading resource in new tab

* the referrer is on the request of the event not directly on the event

---------

Co-authored-by: bmartel <bmartel@users.noreply.github.com>
@deppp deppp deleted the fb-lsdv-5096 branch November 14, 2023 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants