Makes local protocol navigable #94
No reviewers
Labels
No Label
blocked
bug
build
documentation
duplicate
enhancement
finger
gemini
gopher
help wanted
http
in progress
invalid
local
needs-info
non-code
non-functional
non-urgent
question
release
rendering
suggestion
telnet
terminal
urgent
wontfix
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sloum/bombadillo#94
Loading…
Reference in New Issue
No description provided.
Delete Branch "improved-local"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I know I said no more features. I was bored on a Friday at work and had already gone over the website release page stuff and updated the makefile for adding desktop files and protocol handlers... so I decided to give this a whirl.
This PR accomplishes the following (all in relation to the
local
protocol):As a part of this I have also tested that error messaging is appropriate when a user tries to open a file they do not have permissions for.
It all works pretty well and actually makes Bombadillo usable as a file browser. Probably wouldn't be my first choice as a daily driver, but it now boasts more than just afterthought file handling.
This is not an urgent item, so if it becomes a choice time-wise to check this out or handle other stuff, I definitely lean toward the other stuff. Though I would put this in the "nice to have" category for 2.0.0 if we can squeeze it in.
This is a really good usability improvement.
It handles permissions errors well.
I didn't realise that you can use this to view binary files. That has some weird behaviour, which is expected, but do you think it has a chance to break the display? I assume that filtering of escape codes would prevent this?
I'm glad you like it. I think it actually makes it usable as a file browser.
I dont think there should be any issues with escape codes. They should still get filtered out by the line wrapping routine.
Do you know why the terminal bell rings when you browse through binary files? I thought it was because of escape codes but if we are filtering a it must be something else. Not really important though, I'll try to do some research on it.
Do you think you can add an entry for
..
so that you can follow a link to go up a level?Appending
/
(or a path separator) to the end of directory names would help make it clearer what they are. It might add unnecessary complexity though (I haven't looked at the code yet), and you can already see what is a directory from the left column.Word wrapping looks good too. It's a really good enhancement overall, functionally I'd say it's ready.
a
is not an VT-100 escape sequence (which is what gets filtered out). It is an ascii character (ascii char 7). In theory I can add that to the filtering if you think that would be a good idea.I can definitely add the
..
. That is a great idea that will really help navigability. I can also add the/
to directory listings. Both are trivial additions. I'll do them now and let you know once they are in.Ok. The following has been done:
..
has been added for all directory listings except for the root directorya
has been filtered out for all pages, preventing people from bell spamming (not that I've ever seen anyone do it, but it sounds fun to troll people that way with a phlog entry)/
A couple of items of feedback, but otherwise pretty solid. A good enhancement.
@ -23,2 +27,3 @@
fileList, err := file.Readdir(0)
if err != nil {
return "", fmt.Errorf("Unable to read from directory: %s", address)
return "", links, fmt.Errorf("Unable to read from directory: %s", address)
I've found it can be useful to include the error message coming from the FS operation. It will normally indicate why something has happened, and the error message is somewhat readable. There's other instances of this here, is this something you would consider changing?
I agree. The error messaging for this module is generally pretty readable and will be useful to users. I have changed this in the relevant locations in
locals.go
.@ -28,2 +33,2 @@
for _, obj := range fileList {
out.WriteString(obj)
if address != "/" {
Looking at bash, it includes ".." in the list of files in root, so this distinction may not be needed from a user perspective. The behaviour I see is that following
..
from root just lands you back at root. Removing this logic check seems to do the same thing with no error messages, maybe it can be omitted?If you did want to keep doing this, hardcoding root as
"/"
may not be as compatible as usingfilepath.VolumeName
(but, I don't really know, it is just the closest thing I could see).Yup, a quick test in
play.golang.org
shows that this works well. I agree ditching that hard-coded base path is a better cross-platform solution. I have removed theif
and it just always builds the..
path version. I also added some basic comments to the code in-case it ever needs revisiting.Sorry I wrote "otherwise pretty solid" in the review somewhat automatically, and it doesn't really reflect my feeling on it. It is good solid work, regardless of the items I've called out for review. Well done once again.
Having made the two requested updates (I left comments on both, hopefully you can still see them?), I am merging this in. If anything else comes up with this, let me know. I think it should be good though.
No worries about the language. I know you weren't intending to, as the kids say: "throw shade", lol. Realistically, I am pretty happy with someone calling my code pretty solid, as it isnt always the case. I'll take it! 👍 That said, thank you for the well done :)