summaryrefslogtreecommitdiff
path: root/system/db/content.go
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2016-12-14 09:07:50 -0800
committerSteve Manuel <nilslice@gmail.com>2016-12-14 09:07:50 -0800
commitbd96fae14bc6201cb6e81b1cb2c51b00314810b6 (patch)
treef1fb77f72987c8020eaf54d56f213c3839c98586 /system/db/content.go
parent6808d3bf58e19e9230e7966798a70406f6d306e0 (diff)
maintain original slug and append to it with single incremental value, not many
Diffstat (limited to 'system/db/content.go')
-rw-r--r--system/db/content.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/system/db/content.go b/system/db/content.go
index 52fc8d5..0661556 100644
--- a/system/db/content.go
+++ b/system/db/content.go
@@ -494,6 +494,7 @@ func checkSlugForDuplicate(slug string) (string, error) {
// check for existing slug in __contentIndex
err := store.View(func(tx *bolt.Tx) error {
b := tx.Bucket([]byte("__contentIndex"))
+ original := slug
exists := true
i := 0
for exists {
@@ -504,7 +505,7 @@ func checkSlugForDuplicate(slug string) (string, error) {
}
i++
- slug = fmt.Sprintf("%s-%d", slug, i)
+ slug = fmt.Sprintf("%s-%d", original, i)
}
return nil