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: savePage throw on relative paths #32728

Merged
merged 1 commit into from Feb 7, 2022
Merged

fix: savePage throw on relative paths #32728

merged 1 commit into from Feb 7, 2022

Conversation

codebytere
Copy link
Member

@codebytere codebytere commented Feb 3, 2022

Description of Change

Closes #32696.

Fixes an issue where webContents.savePage failed consistently on Windows and Linux and sporadically on macOS when passing a relative path instead of an absolute one. Our version of savePage plumbs down to content/browser/web_contents/web_contents_impl.cc, which, per comment:

Used in automated testing to bypass prompting the user for file names. Instead, the names and paths are hard coded rather than running them through file name sanitation and extension / mime checking.

As a result, there isn't any proper checking for paths being absolute at that layer, since it's a function that assumes what's being passed to it has already been checked and sanitized.

We fix this by performing absolute path checks ourselves.

Checklist

Release Notes

Notes: Fixed an issue where webContents.savePage failed when passing a relative path instead of an absolute one.

@codebytere codebytere added semver/patch backwards-compatible bug fixes target/15-x-y labels Feb 3, 2022
@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Feb 3, 2022
@codebytere codebytere force-pushed the save-page-absolute branch 2 times, most recently from d2afe58 to ddb0182 Compare February 3, 2022 13:18
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Feb 4, 2022
@codebytere codebytere merged commit 81fcd73 into main Feb 7, 2022
@codebytere codebytere deleted the save-page-absolute branch February 7, 2022 08:52
@release-clerk
Copy link

release-clerk bot commented Feb 7, 2022

Release Notes Persisted

Fixed an issue where webContents.savePage failed when passing a relative path instead of an absolute one.

@trop
Copy link
Contributor

trop bot commented Feb 7, 2022

I was unable to backport this PR to "16-x-y" cleanly;
you will need to perform this backport manually.

@trop trop bot removed the target/16-x-y label Feb 7, 2022
@trop
Copy link
Contributor

trop bot commented Feb 7, 2022

I was unable to backport this PR to "15-x-y" cleanly;
you will need to perform this backport manually.

@trop
Copy link
Contributor

trop bot commented Feb 7, 2022

I was unable to backport this PR to "17-x-y" cleanly;
you will need to perform this backport manually.

@trop trop bot removed the target/15-x-y label Feb 7, 2022
@trop
Copy link
Contributor

trop bot commented Feb 7, 2022

I was unable to backport this PR to "18-x-y" cleanly;
you will need to perform this backport manually.

@trop
Copy link
Contributor

trop bot commented Feb 21, 2022

The backport process for this PR has been manually initiated - sending your PR to 15-x-y!

@trop
Copy link
Contributor

trop bot commented Feb 21, 2022

I have automatically backported this PR to "17-x-y", please check out #33016

@trop
Copy link
Contributor

trop bot commented Feb 21, 2022

I was unable to backport this PR to "16-x-y" cleanly;
you will need to perform this backport manually.

@trop
Copy link
Contributor

trop bot commented Feb 21, 2022

I was unable to backport this PR to "15-x-y" cleanly;
you will need to perform this backport manually.

@trop
Copy link
Contributor

trop bot commented Feb 21, 2022

@codebytere has manually backported this PR to "16-x-y", please check out #33017

@trop
Copy link
Contributor

trop bot commented Feb 21, 2022

@codebytere has manually backported this PR to "15-x-y", please check out #33018

@codebytere
Copy link
Member Author

/trop run backport-to 18-x-y

@trop
Copy link
Contributor

trop bot commented Feb 21, 2022

The backport process for this PR has been manually initiated - sending your PR to 18-x-y!

@trop
Copy link
Contributor

trop bot commented Feb 21, 2022

I have automatically backported this PR to "18-x-y", please check out #33019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/patch backwards-compatible bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: savePage no generated files
4 participants