fix: duplicated file may has different line endings#77
Merged
math2001 merged 3 commits intomath2001:masterfrom Mar 2, 2022
Merged
fix: duplicated file may has different line endings#77math2001 merged 3 commits intomath2001:masterfrom
math2001 merged 3 commits intomath2001:masterfrom
Conversation
Python's stream writing uses OS's line ending. So if you duplicate a Unix line ending file on Windows by writing file content, the duplicate file will use \r\n as its line ending. Why we don't use copy file API at the first place? Signed-off-by: Jack Cherng <jfcherng@gmail.com>
It just can't be done. Even worse, if the user select "overwrite", the source file gets deleted first, and no destination file will be created because no source file can be opened anymore. Signed-off-by: Jack Cherng <jfcherng@gmail.com>
Signed-off-by: Jack Cherng <jfcherng@gmail.com>
Owner
|
Looks good thanks for the fix. |
Closed
Contributor
Author
|
@math2001 Thanks for merging. Mind creating a new release? 😄 |
Owner
|
yep haha i'm doing a batch of PRs and I'll release EDIT: done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix: duplicated file may has different line endings
Python's IO stream writing uses OS's line ending. So if you duplicate a Unix line ending file on Windows by writing file
content, the duplicate file will use
\r\nas its line ending. Why we don't use copy file API at the first place?fix: disallow duplicate file with dst = src
It just can't be done. Even worse, if the user select "overwrite", the source file gets deleted first, and no destination file will be created because no source file can be opened anymore.