Browse Source

Merge branch 'fix-asset'

master
parent
commit
7d8af00ef8
  1. 7
      asset.php
  2. 2
      src/CategoryOverpass.js

7
asset.php

@ -15,10 +15,6 @@ if (!array_key_exists($repoId, $allRepositories)) {
$repoData = $allRepositories[$repoId];
$repo = getRepo($repoId, $repoData);
if (!array_key_exists('dir', $_REQUEST)) {
$_REQUEST['dir'] = '.';
}
if (array_key_exists('list', $_REQUEST)) {
$contents = array();
foreach ($repo->scandir($_REQUEST['dir']) as $f) {
@ -32,7 +28,7 @@ if (array_key_exists('list', $_REQUEST)) {
}
else {
$tmpfile = tempnam('/tmp', 'osb-asset-');
$contents = $repo->file_get_contents("{$_REQUEST['dir']}/{$_REQUEST['file']}");
$contents = $repo->file_get_contents((array_key_exists('dir', $_REQUEST) ? "{$_REQUEST['dir']}/" : '') . $_REQUEST['file']);
if ($contents === false) {
Header("HTTP/1.1 401 Permission denied");
@ -44,4 +40,5 @@ else {
}
Header("Content-Type: {$mime_type}; charset=utf-8");
Header("Cache-Control: max-age=86400");
print $contents;

2
src/CategoryOverpass.js

@ -220,7 +220,7 @@ CategoryOverpass.prototype.updateAssets = function (div) {
}
} else if (!src.match(/^(https?:|data:|\.|\/)/)) {
img.setAttribute('src', (typeof openstreetbrowserPrefix === 'undefined' ? './' : openstreetbrowserPrefix) +
'asset.php?repo=' + this.options.repositoryId + '&file=' + encodeURIComponent(img.getAttribute('src')))
'asset.php?repo=' + this.options.repositoryId + '&file=' + encodeURIComponent(img.getAttribute('data-src') || img.getAttribute('src')))
}
}
}

Loading…
Cancel
Save