desktop-pwas: Disallow . in Win7 launcher filename
This change replaces any '.' characters in a PWA launcher's filename with '_' on Windows 7 to prevent launchers from having misleading or potentially unsafe file extensions, such as those in net::IsShellIntegratedExtension(). This is largely a just-in-case measure added because a PWA launcher on Windows 7 has no extension. This change also simplifies the logic for legitimizing a reserved filename on Windows by prepending '_' rather than appending it. On Windows, each Progressive Web App (PWA) must have its own launcher in order for the PWA to be able to register as a handler for file types. On Windows 7, the filename of this launcher is used as the PWA's display name in the Open With menu, because Windows 7 lacks an alternate way to set multiple custom display names for one executable (and PWA launchers are identical copies of chrome_pwa_launcher.exe). The launcher filename is based on the PWA's name, with modifications to ensure the resulting filename is legitimate. These modifications are as follows: * Replace illegal characters with '_' * If filename is reserved on Windows: - OLD: + Append '_' + Replace all '.' with '_'; this was necessary because Windows' logic for checking reserved filenames views characters after '.' as file extensions, and only the pre-file-extension portion is checked for legitimacy (e.g. "nul" is reserved; "nul_" is allowed, but "nul.a_" is not). - NEW: + Prepend '_' * NEW: On Windows 7, replace all '.' with '_' Change-Id: Ibb2a183a8f023e5cbd98adb143e95551c49a1218 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2002982 Commit-Queue: Jesse McKenna <jessemckenna@google.com> Reviewed-by:Giovanni Ortuño Urquidi <ortuno@chromium.org> Reviewed-by:
Matt Giuca <mgiuca@chromium.org> Cr-Commit-Position: refs/heads/master@{#734265}
Showing
Please register or sign in to comment