mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 21:35:39 +00:00
232587 - firefox goes into an infinite loop when using Save Link to Disk to overwrite a file with no dots in the filename. patch by pike, <pike@pikey.me.uk>, r=ben@mozilla.org
This commit is contained in:
parent
796efc7376
commit
a90ed91635
@ -419,13 +419,13 @@ function getTargetFile(aData, aSniffer, aContentType, aIsDocument, aSkipPrompt,
|
||||
while (file.exists()) {
|
||||
var parts = /.+-(\d+)(\..*)?$/.exec(file.leafName);
|
||||
if (parts) {
|
||||
file.leafName = file.leafName.replace(/((\d+)\.)/,
|
||||
function (str, p1, part, s) {
|
||||
return (parseInt(part) + 1) + ".";
|
||||
file.leafName = file.leafName.replace(/((\d+)\.)|((\d+)$)/,
|
||||
function (str, dot, dotNum, noDot, noDotNum, pos, s) {
|
||||
return (parseInt(str) + 1) + (dot ? "." : "");
|
||||
});
|
||||
}
|
||||
else {
|
||||
file.leafName = file.leafName.replace(/\./, "-1$&");
|
||||
file.leafName = file.leafName.replace(/\.|$/, "-1$&");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -267,13 +267,13 @@ nsUnknownContentTypeDialog.prototype = {
|
||||
while (aLocalFile.exists()) {
|
||||
var parts = /.+-(\d+)(\..*)?$/.exec(aLocalFile.leafName);
|
||||
if (parts) {
|
||||
aLocalFile.leafName = aLocalFile.leafName.replace(/((\d+)\.)/,
|
||||
function (str, p1, part, s) {
|
||||
return (parseInt(part) + 1) + ".";
|
||||
aLocalFile.leafName = aLocalFile.leafName.replace(/((\d+)\.)|((\d+)$)/,
|
||||
function (str, dot, dotNum, noDot, noDotNum, pos, s) {
|
||||
return (parseInt(str) + 1) + (dot ? "." : "");
|
||||
});
|
||||
}
|
||||
else {
|
||||
aLocalFile.leafName = aLocalFile.leafName.replace(/\./, "-1$&");
|
||||
aLocalFile.leafName = aLocalFile.leafName.replace(/\.|$/, "-1$&");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user