When saving files, it's easy to overwrite an existing file #68

Closed
opened 2019-10-29 10:15:45 +00:00 by asdf · 3 comments
Collaborator

When saving files, there are no checks to prevent overwriting existing files. So if you were to visit gopher://web.site:70/0/todo.txt and save the file using :w . your own file called todo.txt would be overwritten without warning.

When saving files, there are no checks to prevent overwriting existing files. So if you were to visit gopher://web.site:70/0/todo.txt and save the file using `:w .` your own file called todo.txt would be overwritten without warning.
asdf added the
enhancement
label 2019-10-29 10:15:45 +00:00
Owner

Something I just remembered as well is that saving will break on certain gopher sites... or at least get weird. The gopher url RFC does not require use of slashes as a path separator. As a result conman.org and a few other sites use : or other items. This inconsistency will make choosing a filename for those sites weird.

To the root issue here, a call to something like fileExists (I cant remember what it is called in go) in a loop appending numbers as needed until a file name is available would probably work. Though there may be a better way. We'd probably want the number to go before any file extension.

Something I just remembered as well is that saving will break on certain gopher sites... or at least get weird. The gopher url RFC does not require use of slashes as a path separator. As a result conman.org and a few other sites use `:` or other items. This inconsistency will make choosing a filename for those sites weird. To the root issue here, a call to something like `fileExists` (I cant remember what it is called in go) in a loop appending numbers as needed until a file name is available would probably work. Though there may be a better way. We'd probably want the number to go before any file extension.
Owner

A fix for this is open as PR #73 , I will close this if/once it gets merged in.

A fix for this is open as PR #73 , I will close this if/once it gets merged in.
asdf closed this issue 2019-11-05 09:47:57 +00:00
Author
Collaborator

Fixed in #73

Fixed in #73
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sloum/bombadillo#68
No description provided.