code icon indicating copy to clipboard operation
code copied to clipboard

*.html is not a text file on sshftp server

Open Nine-H opened this issue 5 years ago • 10 comments

Current behavour: code is not showing .html files in the sidebar and throws an error when I open them

Expected: html files editable and on sidebar.

I don't know why it's doing this, surely nobody would let this behaviour slip through. I'm on stable.

screenshot from 2019-03-05 18 16 07

edit: the file was on an sshftp session, seems to work fine on local machine.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Nine-H avatar Mar 05 '19 07:03 Nine-H

Please look at the properties of the file you cannot open using Files or otherwise. What mime-type is it? What are the permissions? I just tried to open an html page downloaded from the web (mime-type text/html) and it opened OK (although my version of Code is compiled from master source)

jeremypw avatar Mar 05 '19 15:03 jeremypw

Also, what happens if you press "Load Anyway"?

jeremypw avatar Mar 05 '19 16:03 jeremypw

At the moment, Code warns if the file mime-type is not a subtype of "text/plain".

jeremypw avatar Mar 05 '19 16:03 jeremypw

load anyway opens the file, the file is owned by me and the permissions are fine, but it's on an sshftp session to an lxc-container. when I cloned the repo down to my projects folder it worked fine, I'll edit the bug to reflect this.

Nine-H avatar Mar 05 '19 22:03 Nine-H

Maybe the content type could not be determined in that situation. Perhaps Code should fallback to to relying on the extension in that case. At least the warning words could be improved.

jeremypw avatar Mar 06 '19 09:03 jeremypw

I have the same problem on a local file. Html is not being shown on the editor.

Hedronmx avatar Mar 14 '19 19:03 Hedronmx

Can also confirm this is the case for me still in elementary OS 6. Load anyway still solves it, but this sorta breaks workflow if you need to open multiple html files over ssh.

kmandarin-orange avatar Nov 04 '21 18:11 kmandarin-orange

May be better to not check in advance and just give indication if loading fails.

jeremypw avatar Nov 04 '21 19:11 jeremypw

More frustratingly, this also prevents html and other text-like files from being shown in the left sidebar when you open a project folder that's a mounted remote sftp file.

leoherzog avatar Jun 03 '22 14:06 leoherzog

I do not think that Code was initially envisaged to be used to edit remote files over e.g. sftp. I do all my development locally. But if users want it and the git library works properly over such protocols (from inside a flatpak) I guess its something that could be implemented.

jeremypw avatar Jun 03 '22 16:06 jeremypw

I am going to close this as I do not think the intended use of Code is to edit documents over SFTP (or other remote protocol). Performance over a remote link is likely to be poor. Please download the file, edit it, and then upload.

I have not found any issue editing simple .html files locally. Editing over SMB also worked albeit with significant lag when autosave was ON. The html files were shown in the sidebar.

Please reopen with an example problematic html file which either cannot be edited or does not appear in the sidebar when local.

jeremypw avatar Jul 07 '23 17:07 jeremypw