]> git.r.bdr.sh - rbdr/mobius/commitdiff
Exclude unsupported >4GiB files from file listings
authorJeff Halter <redacted>
Tue, 7 Jun 2022 23:01:46 +0000 (16:01 -0700)
committerJeff Halter <redacted>
Tue, 7 Jun 2022 23:01:46 +0000 (16:01 -0700)
hotline/files.go

index e77f63129f1a5e574b4260aff4c8649e066bafc3..d07f4455ebe188774a99164a5b033f55c141de7b 100644 (file)
@@ -86,6 +86,10 @@ func getFileNameList(filePath string) (fields []Field, err error) {
                        copy(fnwi.Type[:], []byte("fldr")[:])
                        copy(fnwi.Creator[:], fileCreator[:])
                } else {
                        copy(fnwi.Type[:], []byte("fldr")[:])
                        copy(fnwi.Creator[:], fileCreator[:])
                } else {
+                       // the Hotline protocol does not support file sizes > 4GiB due to the 4 byte field size, so skip them
+                       if file.Size() > 4294967296 {
+                               continue
+                       }
                        binary.BigEndian.PutUint32(fnwi.FileSize[:], uint32(file.Size()))
                        copy(fnwi.Type[:], []byte(fileTypeFromFilename(file.Name()).TypeCode)[:])
                        copy(fnwi.Creator[:], []byte(fileTypeFromFilename(file.Name()).CreatorCode)[:])
                        binary.BigEndian.PutUint32(fnwi.FileSize[:], uint32(file.Size()))
                        copy(fnwi.Type[:], []byte(fileTypeFromFilename(file.Name()).TypeCode)[:])
                        copy(fnwi.Creator[:], []byte(fileTypeFromFilename(file.Name()).CreatorCode)[:])