Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
version: '2.1'
services:
svn:
image: solsson/rweb-httpd:1.6.4@sha256:ea15cc8e7826af8e81fd675707381cc2148524d839fbcda2376a452361cc942d
image: solsson/rweb-httpd:1.7.1@sha256:1c7e5aeac975444d1f04dc4b973fa3ec022e4090771cdfd6f9dfd933d4ae5f81
expose:
- "80"
ports:
Expand All @@ -20,7 +20,7 @@ services:
volumes:
- .:/opt/rweb
rweb:
image: solsson/rweb:1.6.4@sha256:fe32cc82f675d447ffb4f4a7a03fe9a62a83097eda5097dded6134c6ecba46b9
image: solsson/rweb:1.7.1@sha256:ba81308d841f1cc62409b77afd9f178c16c10c450aa3f863ac828350c7bdd28e
expose:
- "9000"
links:
Expand Down
15 changes: 15 additions & 0 deletions repos-plugins/thumbnails/convert/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,21 @@ function getThumbnailCommand($transform, $format='', $target='-') {
// handleError(412, "Revision number required ".$r->getValue());
//}

if (isset($_REQUEST['accept'])) {
$extensions = preg_split('/[,\s]+/', $_REQUEST['accept'], -1, PREG_SPLIT_NO_EMPTY);
$targetUrl = getTargetUrl();
$probe = '';
do {
$s = new ServiceRequest($targetUrl.$probe);
$s->setSkipBody();
$s->exec();
if ($s->getStatus() == 200) {
$_REQUEST['target'] .= $probe;
break;
}
} while ($probe = array_shift($extensions));
}

// First get the data about the repository image
// Consider this an implementation of ReposGraphicsTransformSource
// We only use SvnOpenFile to check existence, and the operation could maybe be made faster as we don't need the info
Expand Down
8 changes: 8 additions & 0 deletions repos-plugins/uploadform/uploadform.load.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ function autoFillFilename(path) {
$(document).say();
var pos = Math.max(path.lastIndexOf('/'), path.lastIndexOf('\\'));
var filename = path.substring(pos + 1);

var fileext = (/\.(\w{1,4})$/.exec(filename) || [])[1];
var qs = $.deparam.querystring();

if (fileext && qs.accept && /^[^\.]+$/.test(suggested)) {
suggested = suggested + '.' + fileext.toLowerCase();
$('#name').val(suggested);
}

if (!v) {
suggested = suggested && !!$('#name').val();
Expand Down
13 changes: 1 addition & 12 deletions repos-web/edit/upload/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,6 @@
}
}

function fileInputAccept($suggestname) {
if (!$suggestname) return;

//preg_match('/\((?:([a-z0-9]+)[|)])+$/', $suggestname, $matches);

preg_match('/\(((?:[a-z0-9]+\|?)+)\)$/', $suggestname, $matches);
if (!count($matches)) return;
$extensions = explode('|', $matches[1]);

return 'accept=".' . implode(',.', $extensions) . '" ';
}

function showUploadForm() {
header("Cache-Control: no-cache, must-revalidate"); // the history part of the form must be updated after successful upload to avoid strange conflicts - disable caching until we have a better solution
$template = Presentation::getInstance();
Expand All @@ -93,6 +81,7 @@ function showUploadForm() {
} else {
$template->assign('folderurl', $file->getUrl());
$template->assign('suggestname', isset($_GET['suggestname']) ? $_GET['suggestname'] : '');
$template->assign('accept', isset($_GET['accept']) ? $_GET['accept'] : '');
}
$template->assign('maxfilesize',MAX_FILE_SIZE);
$template->assign('isfile',$file->isFile());
Expand Down
2 changes: 1 addition & 1 deletion repos-web/edit/upload/index_en.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ <h1>Upload file</h1>
<p>
<label for="userfile">local file</label>
<input type="hidden" name="MAX_FILE_SIZE" value="{=$maxfilesize}" />
<input type="file" id="userfile" name="userfile" class="required current-name" size="40" tabindex="1" {=$suggestname|fileInputAccept}/>
<input type="file" id="userfile" name="userfile" class="required current-name" size="40" tabindex="1" {=if $accept}accept="{=$accept}"{=/if}/>
<span class="note">Maximum file size {=$maxfilesize|formatSize}</span>
</p>
<p>
Expand Down
Loading