feat: invalid symlink icon
parent
8a43413f88
commit
b14b9114f8
|
@ -322,7 +322,7 @@ func (i *FileInfo) readListing(checker rules.Checker, readHeader bool) error {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
isSymlink := false
|
isSymlink, isInvalidLink := false, false
|
||||||
if IsSymlink(f.Mode()) {
|
if IsSymlink(f.Mode()) {
|
||||||
isSymlink = true
|
isSymlink = true
|
||||||
// It's a symbolic link. We try to follow it. If it doesn't work,
|
// It's a symbolic link. We try to follow it. If it doesn't work,
|
||||||
|
@ -330,6 +330,8 @@ func (i *FileInfo) readListing(checker rules.Checker, readHeader bool) error {
|
||||||
info, err := i.Fs.Stat(fPath)
|
info, err := i.Fs.Stat(fPath)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
f = info
|
f = info
|
||||||
|
} else {
|
||||||
|
isInvalidLink = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,11 +352,15 @@ func (i *FileInfo) readListing(checker rules.Checker, readHeader bool) error {
|
||||||
} else {
|
} else {
|
||||||
listing.NumFiles++
|
listing.NumFiles++
|
||||||
|
|
||||||
|
if isInvalidLink {
|
||||||
|
file.Type = "invalid_link"
|
||||||
|
} else {
|
||||||
err := file.detectType(true, false, readHeader)
|
err := file.detectType(true, false, readHeader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
listing.Items = append(listing.Items, file)
|
listing.Items = append(listing.Items, file)
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
...mapMutations(["addSelected", "removeSelected", "resetSelected"]),
|
...mapMutations(["addSelected", "removeSelected", "resetSelected"]),
|
||||||
humanSize: function () {
|
humanSize: function () {
|
||||||
return filesize(this.size);
|
return this.type == "invalid_link" ? "invalid link" : filesize(this.size);
|
||||||
},
|
},
|
||||||
humanTime: function () {
|
humanTime: function () {
|
||||||
if (this.readOnly == undefined && this.user.dateFormat) {
|
if (this.readOnly == undefined && this.user.dateFormat) {
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
.file-icons [data-type=pdf] i::before { content: 'description' }
|
.file-icons [data-type=pdf] i::before { content: 'description' }
|
||||||
.file-icons [data-type=text] i::before { content: 'description' }
|
.file-icons [data-type=text] i::before { content: 'description' }
|
||||||
.file-icons [data-type=video] i::before { content: 'movie' }
|
.file-icons [data-type=video] i::before { content: 'movie' }
|
||||||
|
.file-icons [data-type=invalid_link] i::before { content: 'link_off' }
|
||||||
|
|
||||||
/* #f90 - Image */
|
/* #f90 - Image */
|
||||||
|
|
||||||
|
@ -125,6 +126,7 @@
|
||||||
.file-icons [data-type=audio] i { color: var(--icon-yellow) }
|
.file-icons [data-type=audio] i { color: var(--icon-yellow) }
|
||||||
.file-icons [data-type=image] i { color: var(--icon-orange) }
|
.file-icons [data-type=image] i { color: var(--icon-orange) }
|
||||||
.file-icons [data-type=video] i { color: var(--icon-violet) }
|
.file-icons [data-type=video] i { color: var(--icon-violet) }
|
||||||
|
.file-icons [data-type=invalid_link] i { color: var(--icon-red) }
|
||||||
|
|
||||||
/* #f00 - Adobe/Oracle */
|
/* #f00 - Adobe/Oracle */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue