Skip to content

Commit

Permalink
Fixed #127
Browse files Browse the repository at this point in the history
  • Loading branch information
Real-Gecko committed Jan 31, 2018
1 parent c3db0b6 commit a11719e
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
## [2.2.0] - 2018-
### Fixed
- Fixed #126
- Fixed #124
- Fixed #125
- Fixed listing of corrupt archives
- Fixed #127

### Added
- Added symlink for text/csv file mimetype image to point to text/plain
Expand Down
3 changes: 2 additions & 1 deletion lang/en
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ select_none=Select None
copy_selected=Copy Selected
cut_selected=Cut Selected
paste=Paste
paste_overwriting=Paste overwriting
paste_symlink=Paste symlink
create_folder=Create Folder
create_file=Create File
Expand Down Expand Up @@ -81,7 +82,7 @@ error_invalid_uri=No valid URL supllied!!!
file_already_exists=already exists in
files_ready_for_upload=View selected files
errors_occured=Following errors occured while performing operation
error_pasting_nonsence=Moving to the same directory makes no sense, use copy and paste to make duplicates
error_pasting_nonsence=Moving or overwriting in the same directory makes no sense, go have some coffee
error_exists=already exists, skipping
error_copy=copying failed with error:
error_cut=moving failed with error:
Expand Down
3 changes: 2 additions & 1 deletion lang/ru.UTF-8
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ error_load_template=Ошибка загрузки шаблона
error_numeric=не является числом!
error_opendir=Ошибка открытия папки
error_opening_file_for_writing=Не удалось открыть файл для записи:
error_pasting_nonsence=Перемещение в ту же папку не имеет смысла, использутей копировать/вставить для создания дубликата
error_pasting_nonsence=Перемещение или перезапись в той же папке не имеет смысла, сходите, выпейте кофе
error_rename=Не удалось переименовать
error_saving_bookmarks=Ошибка сохранения закладок
error_saving_file=Ошибка сохранения файла
Expand Down Expand Up @@ -165,6 +165,7 @@ open_containing_folder=Открыть родительскую папку
owner_group=Группа владельца
owner_user=Владелец
paste=Вставить из буфера обмена
paste_overwriting=Вставить с заменой
paste_symlink=Вставить симлинк
permissions=Разрешения
preparing_download=Подготовка загрузки
Expand Down
5 changes: 3 additions & 2 deletions list_archive.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ my $result;
my $command;

if ($archive_type eq 'application/zip') {
$command = "unzip -l ".quotemeta("$cwd/$file");
$command = "unzip -l ".quotemeta("$cwd/$file")." 2>&1";
$result = `$command`;
print Mojo::JSON::to_json({'success' => $result});
} elsif (index($archive_type, "tar") != -1 || index($archive_type, "gzip") != -1) {
$command = "tar tvf ".quotemeta("$cwd/$file");
$command = "tar tvf ".quotemeta("$cwd/$file")." 2>&1";
$result = `$command`;
# $result = system($command);
print Mojo::JSON::to_json({'success' => $result});
} else {
print Mojo::JSON::to_json({'error' => "$archive_type $text{'error_archive_type_not_supported'}"});
Expand Down
10 changes: 8 additions & 2 deletions paste.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ if(open(my $fh, "<".&get_paste_buffer_file())) {
$dir =~ s/\.\.//g;
$dir = &simplify_path($dir);
my @errors;
if ($cwd eq &simplify_path($base.$dir) & $act eq "cut") {

if ($cwd eq &simplify_path($base.$dir) & ($act eq "cut" || $in{'overwrite'})) {
push @errors, $text{'error_pasting_nonsence'};
} else {
for(my $i = 2;$i <= scalar(@arr)-1;$i++) {
Expand All @@ -27,7 +28,12 @@ if(open(my $fh, "<".&get_paste_buffer_file())) {
$arr[$i] = &simplify_path($arr[$i]);
my @p = split('/', $arr[$i]);
my $name = pop(@p);
my $suggested_name = suggest_filename($cwd, $name);
my $suggested_name;
if ($in{'overwrite'}) {
$suggested_name = $name;
} else {
$suggested_name = suggest_filename($cwd, $name);
}
if ($act eq "copy") {
system("cp -r ".quotemeta($base.$arr[$i]).
" ".quotemeta("$cwd/$suggested_name")) == 0 or push @errors, $base.$arr[$i]." $text{'error_copy'} $!";
Expand Down
6 changes: 6 additions & 0 deletions unauthenticated/js/filemin.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@
case "paste":
paste(tab);
break;
case "paste-overwriting":
paste(tab, 1);
break;
case "symlink":
pasteSymlink(tab);
break;
Expand Down Expand Up @@ -743,6 +746,9 @@ $(document).ready( function () {
case "paste":
paste(tab);
break;
case "paste-overwriting":
paste(tab, 1);
break;
case "symlink":
pasteSymlink(tab);
break;
Expand Down
6 changes: 4 additions & 2 deletions unauthenticated/js/spec-ops.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ function cutSelected(tab, name) {
}
}

function paste(tab) {
function paste(tab, overwrite = 0) {
var notice = showWait(text.paste, text.notice_take_while);
$.post("paste.cgi", { 'path': tab.path })
$.post("paste.cgi", { 'path': tab.path , 'overwrite': overwrite })
.done(function(response) {
if(response.error) {
waitToError(notice, text.error_title, response.error)
Expand Down Expand Up @@ -1144,6 +1144,7 @@ function disableForSearch() {
$('#main-menu .nav li a[data-item="upload_files"]').parent().addClass('disabled');
$('#main-menu .nav li a[data-item="get_from_url"]').parent().addClass('disabled');
$('#main-menu .nav li a[data-item="paste"]').parent().addClass('disabled');
$('#main-menu .nav li a[data-item="paste_overwriting"]').parent().addClass('disabled');
$('#main-menu .nav li a[data-item="symlink"]').parent().addClass('disabled');
$('#main-menu .nav li a[data-item="get_sizes"]').parent().addClass('disabled');
$('#main-menu .nav li a[data-item="compress_selected"]').parent().addClass('disabled');
Expand All @@ -1160,6 +1161,7 @@ function disableForEdit() {
$('#main-menu .nav li a[data-item="copy_selected"]').parent().addClass('disabled');
$('#main-menu .nav li a[data-item="cut_selected"]').parent().addClass('disabled');
$('#main-menu .nav li a[data-item="paste"]').parent().addClass('disabled');
$('#main-menu .nav li a[data-item="paste_overwriting"]').parent().addClass('disabled');
$('#main-menu .nav li a[data-item="symlink"]').parent().addClass('disabled');
$('#main-menu .nav li a[data-item="get_sizes"]').parent().addClass('disabled');
$('#main-menu .nav li a[data-item="chmod_selected"]').parent().addClass('disabled');
Expand Down
3 changes: 3 additions & 0 deletions unauthenticated/templates/context_menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
<li data-item="paste">
<a><i class="fa fa-paste"></i> $text{'paste'}</a>
</li>
<li data-item="paste-overwriting">
<a><i class="fa fa-exclamation-triangle"></i> $text{'paste_overwriting'}</a>
</li>
<li data-item="symlink">
<a><i class="fa fa-link"></i> $text{'paste_symlink'}</a>
</li>
Expand Down
3 changes: 3 additions & 0 deletions unauthenticated/templates/main_menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
<li>
<a data-item="paste"><i class="fa fa-paste"></i> $text{'paste'}</a>
</li>
<li>
<a data-item="paste-overwriting"><i class="fa fa-exclamation-triangle"></i> $text{'paste_overwriting'}</a>
</li>
<li>
<a data-item="symlink"><i class="fa fa-link"></i> $text{'paste_symlink'}</a>
</li>
Expand Down

0 comments on commit a11719e

Please sign in to comment.