]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
Fix a regression: permalinks change when old links are edited
authorArthurHoaro <arthur@hoa.ro>
Thu, 15 Dec 2016 10:18:56 +0000 (11:18 +0100)
committerArthurHoaro <arthur@hoa.ro>
Thu, 15 Dec 2016 10:43:42 +0000 (11:43 +0100)
fixes #713

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.