Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] An erroneous . is added to end of PWA web address in Android apk #78

Closed
Jaifroid opened this issue Jun 29, 2021 · 10 comments · Fixed by pwa-builder/PWABuilder#1884
Labels
bug 🐛 Something isn't working needs triage 🔍

Comments

@Jaifroid
Copy link

Describe the bug

I created Store packages for my PWA by pointing PWABuilder to pwa.kiwix.org/www/index.html . The Windows msix package created from this works just fine. Testing the Android .apk on my phone, the app installs correctly (after fighting Play Protect...), but on launching the app, I get a 404 Not Found page showing in the app. When I look carefully at the URL, I notice that it is pwa.kiwix.org/www/index.html. with that erroneous period/full-stop at the end (see screenshot). I click three dots, and choose "Open in Microsoft Edge", and the same erroneous page opens in Edge for Android. In Edge (but not in the app), I can edit the URL and remove the period, in which case the page loads correctly.

Steps to reproduce

  1. Open PWABuilder and point it to pwa.kiwix.org/www/index.html. It will tell you that the PWA has a score of 150 points.
  2. Create package for Android
  3. Download package, unzip and install apk
  4. Run the installed app

Expected behavior

My PWA should work on Android.

Screenshots

image

Additional info:

  • OS: Windows 10 (Android 11)
  • Browser Microsoft Edge
  • Version 91.0
@Jaifroid Jaifroid added the bug 🐛 Something isn't working label Jun 29, 2021
@ghost ghost added the needs triage 🔍 label Jun 29, 2021
@ghost
Copy link

ghost commented Jun 29, 2021

Hello Jaifroid, thank you for opening an issue with us!

I have automatically added a "needs triage" label to help get things started. Our team will investigate the issue and help solve it ASAP. Other community members may also look into the issue and provide feedback 🙌

@JudahGabriel
Copy link
Collaborator

JudahGabriel commented Jun 30, 2021

Hi @Jaifroid,

I'm looking into this right now and will get back to you shortly.

p.s. in the future, please direct all issues to our main repo. It'll get more eyeballs and faster response time. 👍

@JudahGabriel
Copy link
Collaborator

I'm able to repro. Investigating...

@JudahGabriel
Copy link
Collaborator

I've found the cause of the issue. Submitting a PR now.

@JudahGabriel
Copy link
Collaborator

JudahGabriel commented Jul 1, 2021

OK, so there were 2 problems here:

  1. PWABuilder wasn't properly handling relative paths in certain scenarios.
  2. You're putting the wrong URL into PWABuilder.

I'm submitting a PR for the first item.

But for the second item, your PWA URL is actually https://pwa.kiwix.org. Specifically, your manifest is https://pwa.kiwix.org/manifest.json, and it's start_url is set to "." - so your PWA "real" URL is new URL(".", "https://pwa.kiwix.org/manifest.json") = "https://pwa.kiwix.org".

So, that's the URL you should put into PWABuilder., https://pwa.kiwix.org

I'm submitting a PR to patch up this issue to prevent it from happening in the first place. The fix should be in place by tomorrow (Thursday)

@JudahGabriel
Copy link
Collaborator

Fixed, now in PR:

image

@Jaifroid
Copy link
Author

Jaifroid commented Jul 1, 2021

Thank you for the quick fix @JudahGabriel! I did actually try pwa.kiwix.org as the URL at first, but it told me I didn't have a manifest. I can simulate this still in Firefox (see screenshot below).

image

Now tyring that URL on in Microsoft Edge, the code gets stuck on "If your app does not have a Web Manifest, we are generating one for you...", but your fix may not be in there yet.

image

If I put in pwa.kiwix.org/www/index.html, then I get a very quick "Total Score 150... Congrats! You have a great PWA!". pwa.kiwix.org/www/ also works.

Oddly, pwa.kiwix.org works in Edge after I try the direct version, but not if I open PWABuilder fresh and paste in 'pwa.kiwix.org'. Perhaps PWABuilder fails to follow the redirect in pwa.kiwix.org/index.html (it contains <meta http-equiv="refresh" content="0; url=www/index.html">), but then caches it the second time. I'm guessing.

@JudahGabriel
Copy link
Collaborator

Ah, I see our manifest detector wasn't handling URL redirection in the <head>. I'll update that so that things will work as expected.

JudahGabriel added a commit to pwa-builder/pwabuilder-manifest-finder that referenced this issue Jul 1, 2021
@JudahGabriel
Copy link
Collaborator

I've updated PWABuilder's manifest finding logic to check for HTML-based redirects. Here's the URL that tries to find your manifest: https://pwabuilder-manifest-finder.azurewebsites.net/api/findmanifest?url=https://pwa.kiwix.org

You'll see it now successfully detects your manifest.

Go back to PWABuilder, put https://pwa.kiwix.org into PWABuilder, and things should work this time. 👍

@Jaifroid
Copy link
Author

Jaifroid commented Jul 1, 2021

Great, that works now! Thank you @JudahGabriel for fixing it so quickly.

@ghost ghost locked as resolved and limited conversation to collaborators Aug 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug 🐛 Something isn't working needs triage 🔍
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants