fix: do not expose the name of the root directory (#5224)

This commit is contained in:
Henrique Dias 2025-06-28 08:40:07 +02:00 committed by GitHub
parent 5331969163
commit 089255997a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View File

@ -86,6 +86,11 @@ func NewFileInfo(opts *FileOptions) (*FileInfo, error) {
return nil, err return nil, err
} }
// Do not expose the name of root directory.
if file.Path == "/" {
file.Name = ""
}
if opts.Expand { if opts.Expand {
if file.IsDir { if file.IsDir {
if err := file.readListing(opts.Checker, opts.ReadHeader); err != nil { //nolint:govet if err := file.readListing(opts.Checker, opts.ReadHeader); err != nil { //nolint:govet

View File

@ -150,7 +150,7 @@ const fetchData = async () => {
} }
fileStore.updateRequest(res); fileStore.updateRequest(res);
document.title = `${res.name} - ${t("files.files")} - ${name}`; document.title = `${res.name || t("sidebar.myFiles")} - ${t("files.files")} - ${name}`;
} catch (err) { } catch (err) {
if (err instanceof Error) { if (err instanceof Error) {
error.value = err; error.value = err;