GoogleChromeLabs / bubblewrap

Bubblewrap is a Command Line Interface (CLI) that helps developers to create a Project for an Android application that launches an existing Progressive Web App (PWAs) using a Trusted Web Activity.
Apache License 2.0
2.42k stars 165 forks source link

Apostrophe in shortcut name field breaking packaging. #760

Closed Jaylyn-Barbee closed 1 year ago

Jaylyn-Barbee commented 1 year ago

Describe the bug One of our users over at PWABuilder was attempting to package their site: https://www.lagendanews.com/. In their manifest they have inside of their shortcuts field "name": "L'Agenda N" however, in the bubblewrap service this becomes name:'L'Agenda N' which is breaking due to the single tick inside the name string.

Should we advise them to not using ticks in their string or is this a bug?

To Reproduce Steps to reproduce the behavior: You can use the bubblewrap cli with the manifest url https://www.lagendanews.com/superpwa-manifest.json with default options, should fail at the bubblewrap build step

Expected behavior Expected this character to be escaped or something like that in order to allow packaging

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context Associated PWABuilder issue: https://github.com/pwa-builder/PWABuilder/issues/3817

andreban commented 1 year ago

I can repro the issue. Here's the relevant bit of the issue:

Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
build file 'D:\Projects\twa-project\app\build.gradle': 41: unexpected token: Agenda @ line 41, column 26.
       shortcuts: [[name:'L'Agenda N', short_name:'L'Agenda N', url:'https://www.lagendanews.com/', icon:'shortcut_0']],

The issue is in ShortcutInfro#toString(), which doesn't properly escape the string. The string can be escaped with the escapeGradleString() method.

andreban commented 1 year ago

I created #761 with a fix.

nmetulev commented 1 year ago

Thanks for fixing this so quickly. Out of curiosity, what's the release schedule for these fixes?

andreban commented 1 year ago

We don't have a release schedule and have been releasing "as needed". This is now on v1.19.1. Do let us know if working for you, as there have been changes within the SVG support (should work more widely)