-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure file name is valid when saving web page resources to disk
https://bugs.webkit.org/show_bug.cgi?id=262642 rdar://116419303 Reviewed by Ryosuke Niwa. We currently use the last component of URL as file name, and that could lead to file system error, because a valid URL component may not be a valid file name. To fix that, we are going to generate valid file name based on last component by: 1. encoding escape characters of file system. 2. ensuring length is smaller than 255 bytes. 3. appending sequence number when it's taken by other subresource file. 4. falling back to default file name when last component is empty. Test: WebArchive.SaveResourcesValidFileName * Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp: (WebCore::generateValidFileName): (WebCore::LegacyWebArchive::create): * Tools/TestWebKitAPI/Tests/WebKitCocoa/CreateWebArchive.mm: Canonical link: https://commits.webkit.org/268970@main
- Loading branch information
Showing
2 changed files
with
81 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters