Skip to content

Commit e0aba51

Browse files
committed
fixed directory separator
1 parent f7c389e commit e0aba51

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/controllers/LfmController.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,19 @@ private function formatLocation($location, $type = null, $get_thumb = false)
9191
$working_dir = substr($working_dir, 1);
9292
}
9393

94+
9495
$location .= $working_dir;
9596

9697
if ($type === 'directory' || $type === 'thumb') {
97-
$location .= '/';
98+
$location .= DIRECTORY_SEPARATOR;
9899
}
99100

100-
if ($type === 'thumb') {
101-
$location .= Config::get('lfm.thumb_folder_name') . '/';
101+
//if user is inside thumbs folder there is no need
102+
// to add thumbs substring to the end of $location
103+
$in_thumb_folder = preg_match('/'.Config::get('lfm.thumb_folder_name').'$/i',$working_dir);
104+
105+
if ($type === 'thumb' && !$in_thumb_folder) {
106+
$location .= Config::get('lfm.thumb_folder_name') . DIRECTORY_SEPARATOR;
102107
}
103108

104109
return $location;
@@ -126,6 +131,8 @@ public function getUrl($type = null)
126131

127132
$url = $this->formatLocation($url, $type);
128133

134+
$url = str_replace('\\','/',$url);
135+
129136
return $url;
130137
}
131138

src/views/index.blade.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ function download(file_name) {
422422
423423
function useFile(file) {
424424
var path = $('#working_dir').val();
425-
alert(path);
425+
426426
var item_url = image_url;
427427
428428
@if ("Images" !== $file_type)
@@ -445,6 +445,7 @@ function getUrlParam(paramName) {
445445
446446
var field_name = getUrlParam('field_name');
447447
var url = item_url + file;
448+
url = url.replace(/\\/g,"/");
448449
449450
if (window.opener || window.tinyMCEPopup || field_name || getUrlParam('CKEditorCleanUpFuncNum') || getUrlParam('CKEditor')) {
450451
if (window.tinyMCEPopup) {

0 commit comments

Comments
 (0)