In **!!(green)R4.2!!** ##~file:attachment.jpg## loaded the global file before the local file. This behavior was later inverted, if this behavior is used at all, then the local file should be loaded first.
I guess this behavior was implemented to deal with syntax errors, so the user will get his uploaded file either way. I suggest for the sake of clearness and uniqueness to load only the local file.
1. ##~file:/global_file.jpg##
1. ##~file:local_file.jpg##
This change will cause all these pages with the "wrong" syntax failing to show the alternate global file, when the local version is missing. Imagine you mistakenly uploaded a file global instead of local to a page, then later update the local file, to delete it later - suddenly it shows the forgotten global file - guess nobody wants this, right. If we do an error - we want the error to be shown.
%%(info type="important")
This renders existing **global file links** without the slash after the colon invalid.
"" ""
These links need to be adjusted so that they work again:
##~file:## -> ##~file:/##
%%
##~file:attachment.jpg## should load **only** the local file.
##~file:/attachment.jpg## loads the file in the global namespace, the slash after the colon is now mandatory.
%%(hl diff)
diff --git a/wacko/class/wacko.php b/wacko/class/wacko.php
index acc2ea6..3a944e4 100644
--- a/wacko/class/wacko.php
+++ b/wacko/class/wacko.php
@@ -3603,7 +3603,8 @@
}
else
{
- // 2a -> file:some.zip or file:/cluster/some.zip (local)
+ // 2a -> file:some.zip (local relative)
+ // 2b -> file:/cluster/some.zip (local absolute)
$local_file = $file_array;
$_global = false;
$file_name = $local_file[count($local_file) - 1];
@@ -3641,30 +3642,6 @@
$file_access = true;
}
}
-
- // check for global file
- if (!$href)
- {
- // 2b -> file:some.zip (global)
- if (count($file_array) == 1)
- {
- $file_name = $_file_name;
- $param = $this->parse_media_param($file_name);
-
- // no local file available, take the global file instead
- if ($file_data = $this->check_file_record($param['src'], 0))
- {
- $href = ($this->canonical ? $this->db->base_url : $this->db->base_path) . Ut::join_path(UPLOAD_GLOBAL_DIR, $file_name);
- $_global = true;
-
- // tracking file link
- if ($track && isset($file_data['file_id']))
- {
- $this->track_link($file_data['file_id'], LINK_FILE);
- }
- }
- }
- }
}
// try to find file in global / local storage and return if success
%%
commit:51b3cd3e1518f5ad3680b49d22b590c1921eebd0