mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-06 15:58:39 +09:00
[network/dom] Improve sanitization of download filenames.
This commit is contained in:
parent
b33e80b186
commit
52c03190ee
4 changed files with 26 additions and 3 deletions
|
|
@ -5123,6 +5123,14 @@ nsContentUtils::TriggerLink(nsIContent *aContent, nsPresContext *aPresContext,
|
|||
fileName.SetIsVoid(true); // No actionable download attribute was found.
|
||||
}
|
||||
|
||||
// Sanitize fileNames containing control characters by replacing them with
|
||||
// underscores.
|
||||
if (!fileName.IsVoid()) {
|
||||
for (int i = 0; i < 32; i++) {
|
||||
fileName.ReplaceChar(char16_t(i), '_');
|
||||
}
|
||||
}
|
||||
|
||||
handler->OnLinkClick(aContent, aLinkURI,
|
||||
fileName.IsVoid() ? aTargetSpec.get() : EmptyString().get(),
|
||||
fileName, nullptr, nullptr, aIsTrusted, aContent->NodePrincipal());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue