aboutsummaryrefslogtreecommitdiff
path: root/hotline
diff options
context:
space:
mode:
authorJeff Halter <868228+jhalter@users.noreply.github.com>2023-05-28 09:36:48 -0700
committerJeff Halter <868228+jhalter@users.noreply.github.com>2023-05-28 09:36:48 -0700
commita8e89ca4e65f5db3ee6061ede68aade814b4d75c (patch)
tree75437f0780c6407a3cae2e74795ddc7a737589a8 /hotline
parentb1658a46aebe8aceb23af187de956ef91452f48a (diff)
Misc minor cleanup and linter appeasement
Diffstat (limited to 'hotline')
-rw-r--r--hotline/field.go1
-rw-r--r--hotline/file_wrapper.go36
-rw-r--r--hotline/server.go2
3 files changed, 20 insertions, 19 deletions
diff --git a/hotline/field.go b/hotline/field.go
index c5ae55b..4d2962b 100644
--- a/hotline/field.go
+++ b/hotline/field.go
@@ -74,7 +74,6 @@ type Field struct {
type requiredField struct {
ID int
minLen int
- maxLen int
}
func NewField(id uint16, data []byte) Field {
diff --git a/hotline/file_wrapper.go b/hotline/file_wrapper.go
index b55e9f4..2c796ca 100644
--- a/hotline/file_wrapper.go
+++ b/hotline/file_wrapper.go
@@ -26,7 +26,6 @@ type fileWrapper struct {
rsrcPath string // path to the file resource fork
infoPath string // path to the file information fork
incompletePath string // path to partially transferred temp file
- infoFork *FlatFileInformationFork
ffo *flattenedFileObject
}
@@ -150,26 +149,31 @@ func (f *fileWrapper) dataFile() (os.FileInfo, error) {
return nil, errors.New("file or directory not found")
}
-// move a fileWrapper and its associated metadata files to newPath
+// move a fileWrapper and its associated meta files to newPath.
+// Meta files include:
+// * Partially uploaded file ending with .incomplete
+// * Resource fork starting with .rsrc_
+// * Info fork starting with .info
+// During move of the meta files, os.ErrNotExist is ignored as these files may legitimately not exist.
func (f *fileWrapper) move(newPath string) error {
err := f.fs.Rename(f.dataPath, filepath.Join(newPath, f.name))
if err != nil {
- // TODO
+ return err
}
err = f.fs.Rename(f.incompletePath, filepath.Join(newPath, f.incompleteDataName()))
- if err != nil {
- // TODO
+ if err != nil && !errors.Is(err, os.ErrNotExist) {
+ return err
}
err = f.fs.Rename(f.rsrcPath, filepath.Join(newPath, f.rsrcForkName()))
- if err != nil {
- // TODO
+ if err != nil && !errors.Is(err, os.ErrNotExist) {
+ return err
}
err = f.fs.Rename(f.infoPath, filepath.Join(newPath, f.infoForkName()))
- if err != nil {
- // TODO
+ if err != nil && !errors.Is(err, os.ErrNotExist) {
+ return err
}
return nil
@@ -179,22 +183,22 @@ func (f *fileWrapper) move(newPath string) error {
func (f *fileWrapper) delete() error {
err := f.fs.RemoveAll(f.dataPath)
if err != nil {
- // TODO
+ return err
}
err = f.fs.Remove(f.incompletePath)
- if err != nil {
- // TODO
+ if err != nil && !errors.Is(err, os.ErrNotExist) {
+ return err
}
err = f.fs.Remove(f.rsrcPath)
- if err != nil {
- // TODO
+ if err != nil && !errors.Is(err, os.ErrNotExist) {
+ return err
}
err = f.fs.Remove(f.infoPath)
- if err != nil {
- // TODO
+ if err != nil && !errors.Is(err, os.ErrNotExist) {
+ return err
}
return nil
diff --git a/hotline/server.go b/hotline/server.go
index 386562b..bfc1c11 100644
--- a/hotline/server.go
+++ b/hotline/server.go
@@ -27,8 +27,6 @@ var contextKeyReq = contextKey("req")
type requestCtx struct {
remoteAddr string
- login string
- name string
}
type Server struct {