return strings.Contains(strings.ToLower(string(fp.Items[fp.Len()-1].Name)), "upload")
}
+func (fp *FilePath) IsUserDir() bool {
+ if fp.Len() == 0 {
+ return false
+ }
+
+ return strings.HasPrefix(string(fp.Items[0].Name), "~")
+}
+
+
func (fp *FilePath) Len() uint16 {
return binary.BigEndian.Uint16(fp.ItemCount[:])
}
// Handle special cases for Upload and Drop Box folders
if !cc.Authorize(hotline.AccessUploadAnywhere) {
- if !fp.IsUploadDir() && !fp.IsDropbox() {
+ if !fp.IsUploadDir() && !fp.IsDropbox() && !fp.IsUserDir() {
return cc.NewErrReply(t, fmt.Sprintf("Cannot accept upload of the folder \"%v\" because you are only allowed to upload to the \"Uploads\" folder.", string(t.GetField(hotline.FieldFileName).Data)))
}
}
// Handle special cases for Upload and Drop Box folders
if !cc.Authorize(hotline.AccessUploadAnywhere) {
- if !fp.IsUploadDir() && !fp.IsDropbox() {
+ if !fp.IsUploadDir() && !fp.IsDropbox() && !fp.IsUserDir() {
return cc.NewErrReply(t, fmt.Sprintf("Cannot accept upload of the file \"%v\" because you are only allowed to upload to the \"Uploads\" folder.", string(fileName)))
}
}