]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - index.php
Fix a regression: permalinks change when old links are edited
[github/shaarli/Shaarli.git] / index.php
index cc4483524abd9e6dd8bb9dad96d98f764e48f007..a0a3a8c70648f26098675a21d45387325edda3f3 100644 (file)
--- a/index.php
+++ b/index.php
@@ -1249,10 +1249,12 @@ function renderPage($conf, $pluginManager)
             // Edit
             $created = DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $linkdate);
             $updated = new DateTime();
+            $shortUrl = $LINKSDB[$id]['shorturl'];
         } else {
             // New link
             $created = DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $linkdate);
             $updated = null;
+            $shortUrl = link_small_hash($created, $id);
         }
 
         // Remove multiple spaces.
@@ -1279,7 +1281,7 @@ function renderPage($conf, $pluginManager)
             'created' => $created,
             'updated' => $updated,
             'tags' => str_replace(',', ' ', $tags),
-            'shorturl' => link_small_hash($created, $id),
+            'shorturl' => $shortUrl,
         );
 
         // If title is empty, use the URL as title.