bugy / script-server

Web UI for your scripts with execution management
Other
1.55k stars 246 forks source link

Script editor: align line endings when saving a script to server #592

Open bugy opened 1 year ago

bugy commented 1 year ago

Reported by @IVIJL

Also edit of .sh script through script-server has bug, when I saved it it was complaining that script is missing, but script was there updated from your server(did saved the changes) on same path with same rights but for server it was for some reason unreadable and server didnt see it even with same owner and rights as before. Must be some utf/EOL issue because only thing that helped is that I moved script away and created new file and just CTRL-V through nano there and server started to see it again.

when just editing and saving all went fine but when CTRL-A copy to vscode in which I have LF line ending by default, then modify the script CTRL-A in vscode and put it back in server editor and hit save did make those CRLF endings strange is that my vscode has LF ending by default so CRLF endings must have there been added through windows clipboard somehow so just quick fix will be always apply LF line endings on save in server as LF endings are not an issue in windows enviroments so will work fine everywhere but CRLF is problem in all linux enviroments. also tested when I run simple sed -i 's/\r//' parameterized.sh it will fix line endings and runs again without problems.

bugy commented 1 year ago

Hi @IVIJL, unfortunately, I wasn't able to reproduce the problem. Scripts are opening fine from my linux even with \r\n line endings. But I still made a fix, that line endings are normalized according to an operating system on a server.

If you could test it on dev build, that would be great

IVIJL commented 1 year ago

Hello @bugy didn't notice you had an update for me until now, I did test it today on version 1.18.0, and looks like it's working on windows now, wasn't able to reproduce it either anymore. The script is visible to the server after my modification through vscode and clipboard manipulation. So from windows side it all looks good!

bugy commented 1 year ago

Cool, thanks!