CRLF in files are being converted to LF only
Closed this issue · 5 comments
Description:
When attempting to download a folder from the website, all text files with CRLF line endings are being automatically converted to LF, causing line-ending inconsistencies in the downloaded files.
Steps to Reproduce:
Download a folder using the web tool
Navigate to a folder containing text files with CRLF line endings.
Check the line endings.
Expected Behavior:
The downloaded files should retain their original CRLF line endings as they exist in the repository.
Actual Behavior:
After downloading, the line endings in text files are converted to LF, deviating from the original CRLF line endings.
Additional Information:
This issue is affecting all contributors who download folders on github repositories.
It impacts the consistency of line endings in text files, which can be problematic for cross-platform development.
Workarounds:
Manually converting line endings back to CRLF using a text editor like Notepad++ or Visual Studio Code with the "Change End Of Line Sequence" feature.
Possible Cause:
This issue might be related to Git configuration settings or Git clients auto-converting line endings on Windows systems.
Reproducibility:
This issue is reproducible consistently when downloading folders containing text files with CRLF line endings.
I don’t think this is something I have control over. This website just pulls the files and places them in a ZIP file.
Git does have an option to automatically adapt line endings, but I suppose it's not followed/followable via API
Well, this issue is recent, I've noticed it no more than 3 months ago. Maybe something involving JZip or whatever lib being used right now.
no more than 3 months ago
The repository hasn't seen changes in 7 months: https://github.com/download-directory/download-directory.github.io/commits/main/
The last fetch-related change was a year ago, but it only encoded the filename on fetch: c7b8a5b
The last JSZip-related change was 15 months ago: #73
If it changed recently, it's either:
- your repo config has changed (more likely)
- GitHub has changed behavior (less likely)
Do you have a test URL for this issue?
You can find out what line endings are being returned by GitHub. For example this file should have LF, so only $
is shown:
curl -s https://raw.githubusercontent.com/fregante/text-field-edit/main/.gitignore | cat -e
node_modules$
index.js$
index.d.ts$
*.map$
If GitHub is delivering your files with CRLF you should see ^M$
instead. See https://stackoverflow.com/questions/3569997/how-to-find-out-line-endings-in-a-text-file
Thanks, I'll give it a try.