remove more v1 remnants

kudos @Ribas160
This commit is contained in:
El RIDO 2025-07-21 12:28:40 +02:00
parent cdb8010f6d
commit 734b85eb08
No known key found for this signature in database
GPG key ID: 0F5C940A6BD81F92
5 changed files with 16 additions and 51 deletions

View file

@ -1547,7 +1547,7 @@ jQuery.PrivateBin = (function($) {
// string, so we re-add them if necessary
symmetricKey = CryptTool.base58decode(newKey).padStart(32, '\u0000');
} catch(e) {
symmetricKey = newKey;
throw 'encryption key of unsupported format given or incomplete, mangled URL';
}
}
@ -5727,12 +5727,8 @@ jQuery.PrivateBin = (function($) {
Model.getPasteKey();
} catch (err) {
console.error(err);
// missing decryption key (or paste ID) in URL?
if (window.location.hash.length === 0) {
Alert.showError('Cannot decrypt paste: Decryption key missing in URL (Did you use a redirector or an URL shortener which strips part of the URL?)');
return;
}
Alert.showError('Cannot decrypt paste: Decryption key missing in URL (Did you use a redirector or an URL shortener which strips part of the URL?)');
return;
}
// check if we should request loading confirmation

View file

@ -104,8 +104,8 @@ describe('Model', function () {
'throws exception on empty query string',
common.jscUrl(true, false),
function (url) {
let clean = jsdom('', {url: common.urlToString(url)}),
result = false;
const clean = jsdom('', {url: common.urlToString(url)});
let result = false;
try {
$.PrivateBin.Model.getPasteId();
}
@ -126,15 +126,21 @@ describe('Model', function () {
});
jsc.property(
'returns the fragment of a v1 URL',
'throws exception on v1 URLs',
common.jscUrl(),
function (url) {
url.fragment = '0OIl'; // any non-base58 string
const clean = jsdom('', {url: common.urlToString(url)}),
result = $.PrivateBin.Model.getPasteKey();
const clean = jsdom('', {url: common.urlToString(url)});
let result = false;
try {
$.PrivateBin.Model.getPasteId();
}
catch(err) {
result = true;
}
$.PrivateBin.Model.reset();
clean();
return url.fragment === result;
return result;
}
);
jsc.property(