aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclsr <clsr@clsr.net>2016-06-28 20:00:06 +0200
committerclsr <clsr@clsr.net>2016-06-28 20:00:06 +0200
commit0e78c2307da4177fa49031e717c3688d21428695 (patch)
tree05f4a1247a8c95e14175bc0812e9f218ca5518d3
parentc4670ac63db5b4496bb5d2f6795d7b99af57a762 (diff)
downloadgomf-0e78c2307da4177fa49031e717c3688d21428695.tar.gz
gomf-0e78c2307da4177fa49031e717c3688d21428695.zip
Remove storage folder path collisions for short IDsv0.3.0
-rw-r--r--USAGE2
-rw-r--r--storage.go7
2 files changed, 5 insertions, 4 deletions
diff --git a/USAGE b/USAGE
index bd48ed8..3fea3fa 100644
--- a/USAGE
+++ b/USAGE
@@ -54,7 +54,7 @@ Running
example: --name Example
--id-charset CHARSET
- sets the charset for file IDs in URLs to CHARSET; should only include URL-safe characters and no slashes or underscores
+ sets the charset for file IDs in URLs to CHARSET; should only include URL-safe characters and no slashes
example: --id-charset 0123456789
--id-length LENGTH
diff --git a/storage.go b/storage.go
index f33dc34..b20c189 100644
--- a/storage.go
+++ b/storage.go
@@ -153,10 +153,11 @@ func (s *Storage) randomId() string {
}
func (s *Storage) idToFolder(subfolder, id string) string {
- for len(id) < 3 {
- id = "_" + id
+ name := id
+ for len(name) < 3 {
+ name = "_" + name
}
- return path.Join(s.Folder, subfolder, id[0:1], id[1:3], id)
+ return path.Join(s.Folder, subfolder, name[0:1], name[1:3], id)
}
func (s *Storage) readInput(w io.Writer, r io.Reader) (hash string, size int64, err error) {