Skip to content

Commit

Permalink
Try fix crash
Browse files Browse the repository at this point in the history
  • Loading branch information
4censord committed Oct 12, 2024
1 parent aaf29f1 commit 6d191a9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions server/filesystem/filesystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,7 @@ func (fs *Filesystem) ListDirectory(p string) ([]Stat, error) {

var m *mimetype.MIME
d := "inode/directory"

if !f.IsDir() {
cleanedp := filepath.Join(cleaned, f.Name())
if f.Mode()&os.ModeSymlink != 0 {
Expand All @@ -542,11 +543,10 @@ func (fs *Filesystem) ListDirectory(p string) ([]Stat, error) {
// @see https://github.com/pterodactyl/panel/issues/4059
if cleanedp != "" && f.Mode()&os.ModeNamedPipe == 0 {
file, err := fs.manager.Open(filepath.Join(cleaned, f.Name()))
if err != nil {
// panic(fmt.Errorf("Error SFTP Open: %s", err))
fmt.Println(err)
if err == nil {
m, _ = mimetype.DetectReader(file)
}
m, _ = mimetype.DetectReader(file)
fmt.Println(err)
} else {
// Just pass this for an unknown type because the file could not safely be resolved within
// the server data path.
Expand Down

0 comments on commit 6d191a9

Please sign in to comment.