sublimehq / sublime_text

Issue tracker for Sublime Text
https://www.sublimetext.com
804 stars 39 forks source link

Windows 11; "Save as type: " drop-down menu doesn't always append File-Extensions. #6401

Open galen-burnett opened 3 months ago

galen-burnett commented 3 months ago

Description of the bug

  1. Make a new file. Do not select a Syntax, via "View —> Syntax"; its default Syntax will be "Plain Text". Open the Save-Dialogue. Select any option in the "Save as type: " drop-down menu; and do not manually enter a File-Extension in the "File name: " Field. The programme will NOT give the file the File-Extension chosen in the "Save as type: " drop-down menu. Here manually appending the File-Extension in the "File name: " Field is the only way to correctly save the file, and even then, the fact that this bug is present gives me cause for concern as to whether or not the file is indeed saving correctly at all...

  2. Make a new file. Select any Syntax, via "View —> Syntax", APART from "Plain Text". Open the Save-Dialogue. Both the File-Extension shown in the "Save as type: " drop-down menu as well as the File-Extension appended to the file's title in the "File name: " Field will match the Syntax chosen earlier; also, choosing at this point any other option from that drop-down menu—including .TXT—will successfully change the File-Extension in the "File name: " Field respectively.

Repeat step-1 above. Now, try applying the process of step-2 [the parts that come after "Make a new file." in that step] to it, using "File —> Save as..." to open the Save-Dialogue. Trying to apply the process of step-2 to it like that will fail.

I'd like to know whether files being saved by Sublime Text are being endangered at all by this bug, i.e., is this bug causing files to be saved in a corrupted state or similar?

Steps to reproduce

[see above]

Expected behavior

[see above]

Actual behavior

[see above]

Sublime Text build number

4169

Operating system & version

Windows 11; Version 10.0.22631, Build 22631

(Linux) Desktop environment and/or window manager

No response

Additional information

No response

OpenGL context information

No response

FichteFoll commented 3 months ago

I'd like to know whether files being saved by Sublime Text are being endangered at all by this bug, i.e., is this bug causing files to be saved in a corrupted state or similar?

No, files will be saved regardless of your choice of file extension. The only thing that may happen is that Windows wrongly assumes a file to be of a different type and tries to open it with an application that cannot handle it. For example, if you save a standard text file (with ASCII text) with the .jpg extension, then opening that file (with standard means) will likely cause Windows to open it with an image viewer because this is what the file extension indicates. This in turn will likely result in the image viewer showing a message akin to "failed to read image" because what it was told to open wasn't actually an image but a text file with the wrong file extension, but the data is still there and the situation can be remedied by simply renaming the file.

The practice of automatically appending the first suitable file extension when specifying a location to save the file to is a standard Windows behavior, by the way, and other OSes do not necessarily exhibit this behavior. The difference between the Plain Text and other syntaxes is that the Plain Text syntax assumes no extension because it is ST's fallback syntax and would thus apply to everything not covered by a dedicated syntax definition.

Does this answer your question? Because you didn't fill in the issue template, I find it hard to extract an actual buggy behavior from your perspective.

FichteFoll commented 3 months ago

See also the related issue #954.