mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-08-17 18:46:23 +02:00
Updates, guess what.., encoding #!@#*.
This commit is contained in:
@@ -3,6 +3,17 @@ modulejs.define('model/entry', ['_', 'core/types', 'core/ajax'], function (_, ty
|
||||
|
||||
var doc = document,
|
||||
domain = doc.domain,
|
||||
forceEncode = function (href) {
|
||||
|
||||
return href
|
||||
.replace(/'/g, '%27')
|
||||
.replace(/\[/g, '%5B')
|
||||
.replace(/\]/g, '%5D')
|
||||
.replace(/\(/g, '%28')
|
||||
.replace(/\)/g, '%29')
|
||||
.replace(/\+/g, '%2B')
|
||||
.replace(/\=/g, '%3D');
|
||||
},
|
||||
location = (function () {
|
||||
|
||||
var testpathname = '/a b',
|
||||
@@ -16,14 +27,14 @@ modulejs.define('model/entry', ['_', 'core/types', 'core/ajax'], function (_, ty
|
||||
location = a.href.replace(/.*:\/\/[^\/]*/, '').replace(/[^\/]*$/, '');
|
||||
|
||||
if (isDecoded) {
|
||||
location = encodeURIComponent(location).replace(/%2F/ig, '/').replace(/'/g, '%27');
|
||||
location = encodeURIComponent(location).replace(/%2F/ig, '/');
|
||||
}
|
||||
|
||||
if (!location) {
|
||||
location = doc.location.href.replace(/.*:\/\/[^\/]*/, '').replace(/[^\/]*$/, '');
|
||||
}
|
||||
|
||||
return location;
|
||||
return forceEncode(location);
|
||||
}()),
|
||||
|
||||
|
||||
@@ -87,6 +98,8 @@ modulejs.define('model/entry', ['_', 'core/types', 'core/ajax'], function (_, ty
|
||||
|
||||
Entry = function (absHref) {
|
||||
|
||||
absHref = forceEncode(absHref);
|
||||
|
||||
var split = splitPath(absHref);
|
||||
|
||||
cache[absHref] = this;
|
||||
@@ -111,7 +124,7 @@ modulejs.define('model/entry', ['_', 'core/types', 'core/ajax'], function (_, ty
|
||||
|
||||
get = function (absHref, time, size, status, isContentFetched) {
|
||||
|
||||
absHref = absHref || location;
|
||||
absHref = forceEncode(absHref || location);
|
||||
|
||||
var self = cache[absHref] || new Entry(absHref);
|
||||
|
||||
|
@@ -9,7 +9,7 @@ modulejs.define('parser/apache-autoindex', ['_', '$', 'core/settings', 'core/for
|
||||
time = format.parseDate($tds.eq(2).text(), 'DD-MMM-YYYY HH:mm'),
|
||||
size = format.parseSize($tds.eq(3).text());
|
||||
|
||||
absHref = absHref + $a.attr('href').replace(/'/g, '%27').replace(/\+/g, '%2B').replace(/\=/g, '%3D');
|
||||
absHref = absHref + $a.attr('href');
|
||||
|
||||
return label === 'Parent Directory' ? null : Entry.get(absHref, time, size);
|
||||
},
|
||||
|
Reference in New Issue
Block a user