diff options
| -rw-r--r-- | hotline/file_path.go | 11 | ||||
| -rw-r--r-- | internal/mobius/handlers_transfers.go | 4 |
2 files changed, 13 insertions, 2 deletions
diff --git a/hotline/file_path.go b/hotline/file_path.go index 6bd538f..33771f1 100644 --- a/hotline/file_path.go +++ b/hotline/file_path.go @@ -100,6 +100,17 @@ func (fp *FilePath) IsUploadDir() bool { return strings.Contains(strings.ToLower(string(fp.Items[fp.Len()-1].Name)), "upload") } +/*STARTFQ*/ +func (fp *FilePath) IsUserDir() bool { + if fp.Len() == 0 { + return false + } + + return strings.HasPrefix(string(fp.Items[0].Name), "~") +} +/*ENDFQ*/ + + func (fp *FilePath) Len() uint16 { return binary.BigEndian.Uint16(fp.ItemCount[:]) } diff --git a/internal/mobius/handlers_transfers.go b/internal/mobius/handlers_transfers.go index c5eab8c..67c484b 100644 --- a/internal/mobius/handlers_transfers.go +++ b/internal/mobius/handlers_transfers.go @@ -174,7 +174,7 @@ func HandleUploadFolder(cc *hotline.ClientConn, t *hotline.Transaction) (res []h // Handle special cases for Upload and Drop Box folders if !cc.Authorize(hotline.AccessUploadAnywhere) { - if !fp.IsUploadDir() && !fp.IsDropbox() { + if !fp.IsUploadDir() && !fp.IsDropbox() /*STARTFQ*/ && !fp.IsUserDir() /*ENDFQ*/ { return cc.NewErrReply(t, fmt.Sprintf(ErrMsgUploadRestrictedTemplate, "folder", string(t.GetField(hotline.FieldFileName).Data))) } } @@ -224,7 +224,7 @@ func HandleUploadFile(cc *hotline.ClientConn, t *hotline.Transaction) (res []hot // Handle special cases for Upload and Drop Box folders if !cc.Authorize(hotline.AccessUploadAnywhere) { - if !fp.IsUploadDir() && !fp.IsDropbox() { + if !fp.IsUploadDir() && !fp.IsDropbox() /*STARTFQ*/ && !fp.IsUserDir() /*ENDFQ*/{ return cc.NewErrReply(t, fmt.Sprintf(ErrMsgUploadRestrictedTemplate, "file", string(fileName))) } } |