Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fallback to showing UID/GID if user/group lookup fails #1590

Merged
merged 1 commit into from
Feb 4, 2024

Conversation

jantatje
Copy link
Contributor

If you mount a filesystem from another computer then UID/GID might not be mapped to any user. This changes it so that lf shows the UID and GID instead of nothing if user/group lookup fails.

Copy link
Collaborator

@joelim-work joelim-work left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds like a reasonable idea, thanks for the contribution!

BTW you can factor out the fmt.Sprintf call like below, but I don't mind either way:

uid := fmt.Sprint(stat.Uid)
if u, err := user.LookupId(uid); err == nil {
	return u.Username
} else {
	return uid
}

If you mount a filesystem from another computer then UID/GID might
not be mapped to any user. This changes it so that lf shows the UID
and GID instead of nothing if user/group lookup fails.
@gokcehan
Copy link
Owner

gokcehan commented Feb 4, 2024

It looks good. Thank you @jantatje for the patch and @joelim-work for the review.

@gokcehan gokcehan merged commit 2007ae5 into gokcehan:master Feb 4, 2024
4 checks passed
@gokcehan gokcehan mentioned this pull request Mar 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants