diff options
| author | Konstantin Lebedev <9497591+kmlebedev@users.noreply.github.com> | 2023-10-13 02:29:55 +0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-12 14:29:55 -0700 |
| commit | 1cac5d983de408ced3c05a98a6745d1077e7c1e0 (patch) | |
| tree | 68afa8db614baa2ef7296276b32c15fc52d74149 /weed/util/fullpath.go | |
| parent | edee91ef0eb7f7612ae961ac1d1ace2afbd92b87 (diff) | |
| download | seaweedfs-1cac5d983de408ced3c05a98a6745d1077e7c1e0.tar.xz seaweedfs-1cac5d983de408ced3c05a98a6745d1077e7c1e0.zip | |
fix: disallow file name too long when writing a file (#4881)
* fix: disallow file name too long when writing a file
* bool LongerName to MaxFilenameLength
---------
Co-authored-by: Konstantin Lebedev <9497591+kmlebedev@users.noreply.github.co>
Diffstat (limited to 'weed/util/fullpath.go')
| -rw-r--r-- | weed/util/fullpath.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/weed/util/fullpath.go b/weed/util/fullpath.go index 94fe37f36..2259523af 100644 --- a/weed/util/fullpath.go +++ b/weed/util/fullpath.go @@ -29,6 +29,13 @@ func (fp FullPath) Name() string { return name } +func (fp FullPath) IsLongerFileName(maxFilenameLength uint32) bool { + if maxFilenameLength == 0 { + return false + } + return uint32(len([]byte(fp.Name()))) > maxFilenameLength +} + func (fp FullPath) Child(name string) FullPath { dir := string(fp) noPrefix := name |
