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: modify file extension generation on Windows #34723

Merged
merged 12 commits into from Aug 2, 2022
Merged

Conversation

mlaurencin
Copy link
Contributor

@mlaurencin mlaurencin commented Jun 23, 2022

Description of Change

Closes #34450

Previously when saving a file on Windows, the file type would not be defined based on the extension of the file. (The linked issue also mentions that the file name should include the extension, but I could not replicate this on non-Electron applications). The file dialog will now properly display the file type and the saved file will include the extension.

Checklist

  • PR description included and stakeholders cc'd
  • npm test passes
  • tests are changed or added
  • relevant documentation is changed or added

Release Notes

Notes: None

@mlaurencin mlaurencin added semver/patch backwards-compatible bug fixes target/18-x-y labels Jun 23, 2022
@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Jun 23, 2022
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Jun 24, 2022
@ckerr ckerr self-requested a review June 27, 2022 18:11
@mlaurencin mlaurencin changed the title [WIP] fix: modify file extension generation on Windows fix: modify file extension generation on Windows Jun 27, 2022
@mlaurencin mlaurencin marked this pull request as ready for review June 27, 2022 21:54
@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Jun 27, 2022
Copy link
Member

@codebytere codebytere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like there's still a bit of strange behavior here when showing extension and switching between potential save file types 🤔

If I open the html file from this gist in Edge on Windows, right click, and choose "Save Link As" - we get the following popup:

Screen Shot 2022-06-28 at 11 09 00 AM

The title of the item doesn't change if I then switch the file type to All Files:

Screen Shot 2022-06-28 at 11 11 24 AM

I would expect that if I ran the fiddle and clicked the "download" link, I would see a similar popup. At first, the behavior matches:

Screen Shot 2022-06-28 at 11 12 11 AM

However, if I switch the file save type to All Files, the title logic gets a little confused:

Screen Shot 2022-06-28 at 11 12 56 AM

and then if I switch back to PDF File, disappears altogether:

Screen Shot 2022-06-28 at 11 13 45 AM

I'd ideally like to see these match for a more intuitive user experience, and the i think we can do a final review for this :)

Copy link
Member

@codebytere codebytere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(oops see above, meant to req changes!)

@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Jun 28, 2022
Co-authored-by: Charles Kerr <charles@charleskerr.com>
shell/browser/electron_download_manager_delegate.cc Outdated Show resolved Hide resolved
shell/browser/electron_download_manager_delegate.cc Outdated Show resolved Hide resolved
shell/browser/electron_download_manager_delegate.h Outdated Show resolved Hide resolved
shell/browser/electron_download_manager_delegate.cc Outdated Show resolved Hide resolved
shell/browser/electron_download_manager_delegate.cc Outdated Show resolved Hide resolved
@zcbenz zcbenz deleted the file-extension-fix branch August 2, 2022 00:40
@release-clerk
Copy link

release-clerk bot commented Aug 2, 2022

No Release Notes

trop bot pushed a commit that referenced this pull request Aug 2, 2022
* fix: modify file extension generation on Windows

* modify includes

* include vector in header

* add win build flags

* remove hardcoded strings

* Update shell/browser/electron_download_manager_delegate.h

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* fix string manipulation and function definitions

* Update electron_download_manager_delegate.h

* convert to std::string and modify for electron

* Update shell/browser/electron_download_manager_delegate.cc

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* remove vector include and update conversion

* add vectr include for lint

Co-authored-by: Charles Kerr <charles@charleskerr.com>
trop bot pushed a commit that referenced this pull request Aug 2, 2022
* fix: modify file extension generation on Windows

* modify includes

* include vector in header

* add win build flags

* remove hardcoded strings

* Update shell/browser/electron_download_manager_delegate.h

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* fix string manipulation and function definitions

* Update electron_download_manager_delegate.h

* convert to std::string and modify for electron

* Update shell/browser/electron_download_manager_delegate.cc

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* remove vector include and update conversion

* add vectr include for lint

Co-authored-by: Charles Kerr <charles@charleskerr.com>
@trop
Copy link
Contributor

trop bot commented Aug 2, 2022

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

@trop
Copy link
Contributor

trop bot commented Aug 2, 2022

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

@trop
Copy link
Contributor

trop bot commented Aug 2, 2022

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

jkleinsc pushed a commit that referenced this pull request Aug 2, 2022
fix: modify file extension generation on Windows (#34723)

* fix: modify file extension generation on Windows

* modify includes

* include vector in header

* add win build flags

* remove hardcoded strings

* Update shell/browser/electron_download_manager_delegate.h

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* fix string manipulation and function definitions

* Update electron_download_manager_delegate.h

* convert to std::string and modify for electron

* Update shell/browser/electron_download_manager_delegate.cc

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* remove vector include and update conversion

* add vectr include for lint

Co-authored-by: Charles Kerr <charles@charleskerr.com>

Co-authored-by: Michaela Laurencin <35157522+mlaurencin@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
jkleinsc pushed a commit that referenced this pull request Aug 2, 2022
fix: modify file extension generation on Windows (#34723)

* fix: modify file extension generation on Windows

* modify includes

* include vector in header

* add win build flags

* remove hardcoded strings

* Update shell/browser/electron_download_manager_delegate.h

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* fix string manipulation and function definitions

* Update electron_download_manager_delegate.h

* convert to std::string and modify for electron

* Update shell/browser/electron_download_manager_delegate.cc

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* remove vector include and update conversion

* add vectr include for lint

Co-authored-by: Charles Kerr <charles@charleskerr.com>

Co-authored-by: Michaela Laurencin <35157522+mlaurencin@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
schetle pushed a commit to schetle/electron that referenced this pull request Nov 3, 2022
* fix: modify file extension generation on Windows

* modify includes

* include vector in header

* add win build flags

* remove hardcoded strings

* Update shell/browser/electron_download_manager_delegate.h

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* fix string manipulation and function definitions

* Update electron_download_manager_delegate.h

* convert to std::string and modify for electron

* Update shell/browser/electron_download_manager_delegate.cc

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* remove vector include and update conversion

* add vectr include for lint

Co-authored-by: Charles Kerr <charles@charleskerr.com>
khalwa pushed a commit to solarwindscloud/electron that referenced this pull request Feb 22, 2023
* fix: modify file extension generation on Windows

* modify includes

* include vector in header

* add win build flags

* remove hardcoded strings

* Update shell/browser/electron_download_manager_delegate.h

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* fix string manipulation and function definitions

* Update electron_download_manager_delegate.h

* convert to std::string and modify for electron

* Update shell/browser/electron_download_manager_delegate.cc

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* remove vector include and update conversion

* add vectr include for lint

Co-authored-by: Charles Kerr <charles@charleskerr.com>
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]: File extension is missing on Windows
4 participants