-
Notifications
You must be signed in to change notification settings - Fork 29.5k
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
Alternate data streams are removed by saving #6363
Comments
@NotepadPlusUser I would expect this issue to be there in standalone node.js already, if you could try out a |
Thanks, bpasero, for looking at this issue and adding the 'bug' stamp to it. I have to apologise, however, that I don't understand what your reply means.
|
@NotepadPlusUser node.js is the framework we use for writing to files so it would be interesting if this bug is a bug in node.js (https://nodejs.org/en/). By writing a small script like the following we could see if the issue is node.js related or not (using fs.writeFileSync from https://nodejs.org/docs/v5.10.0/api/fs.html#fs_fs_writefilesync_file_data_options):
Where filepath is the path to the file with data streams. |
Apologies bpasero, I'm completely out of my depth here. I tried running the two lines as a bare .js file, but I get the error: Line 1, Char 1, Object expected. I tried running it another environment with the same result, By the way, in line 2, I had substituted filepath with the full path of the target file: I tried instead to post you a TXT file that has two ADS TXT files attached, but of course the transfer to your servers removed them (I tested that by previewing and re-downloading). Then I tried zipping the file first, but that also removed the ADS files.. So I'll have to leave it to the developers to sort out the origin of the problem and the fix. It's a serious matter for windows users, because you often want to put file metadata in an ADS file. |
@NotepadPlusUser can you maybe explain how one gets a file with data streams on Windows? Then I can try to reproduce in node.js. |
[Next morning] Sure. Using good old DOS is the most direct way. The following 5 lines of DOS code will:
Echo "This is the main file" > MainFile.txt So to reproduce the problem:
|
Thanks very much, bpasero, for handling this issue and confirming it. I'll keep a watch on the updates as they come out, and report back. |
Thanks I am able to reproduce with just node.js so this is indeed an upstream issue it seems. |
All right, as @seishun mentioned:
|
VS Code already uses this logic for hidden files thanks to #31733. So it just needs to be applied to all existing files. |
* Use 'r+' with truncation when saving existing files on Windows Opening a file with 'w' flag removes its alternate data streams. To prevent this, extend the logic used for hidden files to all existing files. Fixes: #6363 * adopt truncate for saving as admin
Steps to Reproduce:
I'm sure that there is a setting that will prevent VSCode removing ADS files when saving — they are, after all, a Windows special. If not, could you please regard it as a bug and add such an option.
The text was updated successfully, but these errors were encountered: