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

Blueprints imported via generated My HA widget links broken when original link contains spaces. #482

Open
4 tasks done
changeling opened this issue Aug 23, 2024 · 14 comments
Assignees

Comments

@changeling
Copy link

Checklist

  • I have updated to the latest available Home Assistant version.
  • I have cleared the cache of my browser.
  • I have tried a different browser to see if it is related to my browser.
  • I have tried reproducing the issue in safe mode to rule out problems with unsupported custom resources.

Describe the issue you are experiencing

I'm not sure if this belongs to Frontend, or another repo, but this seems the most likely. If this would be better posted elsewhere, please let me know.

As of 2024.8: Beautiful badges!, Blueprints imported via generated My HA widget links no longer work for original links which contains spaces.

For example:

Doesn't import, yields An unknown error occurred:
View-Assist Travel Time Blueprint with spaces

Does import successfully:
[View-Assist Travel Time Blueprint without spaces]

Describe the behavior you expected

A clean import flow, as demonstrated in the second link.

Steps to reproduce the issue

  1. Attempt to import a Blueprint via an HA Link Generator widget that contains spaces. That is, via a redirected URL containing the link to the file to be imported.

What version of Home Assistant Core has the issue?

2024.8.2

What was the last working version of Home Assistant Core?

No response

In which browser are you experiencing the issue with?

Safari Version 17.5 (19618.2.12.11.6)

Which operating system are you using to run this browser?

MacOS Sonoma 14.5 (23F79)

State of relevant entities

No response

Problem-relevant frontend configuration

No response

Javascript errors shown in your browser console/inspector

No response

Additional information

No response

@changeling
Copy link
Author

Moved to home-assistant/core#124515

@silamon silamon closed this as not planned Won't fix, can't repro, duplicate, stale Aug 24, 2024
@silamon silamon reopened this Aug 24, 2024
@steverep
Copy link
Member

Are you using https://my.home-assistant.io/create-link/ to create the links? If so, what is your input?

@dinki
Copy link

dinki commented Aug 27, 2024

@steverep Yes. Input looks like this:

https://raw.githubusercontent.com/dinki/View-Assist/main/View%20Assist%20custom%20sentences/Travel%20Times%20by%20Waze/blueprint-traveltimesbywaze.yaml

Note that these were all working previously but something has changed as all of those previously working links are nonfunctional now presenting 'An error occurred' when attempting to import.

@changeling
Copy link
Author

changeling commented Aug 27, 2024

@steverep @dinki On this point, I just noticed that https://my.home-assistant.io/create-link/ now refuses to accept https://raw.githubusercontent.com/dinki/View-Assist/main/View%20Assist%20custom%20sentences/Travel%20Times%20by%20Waze/blueprint-traveltimesbywaze.yaml as a valid URL, which it has done in the past.

It will accept this with the %20 replaced with +, which should be a valid space, but the resulting URL has the +s replaced with %2B rather than the correct %20.

Regardless, the resulting redirect URL will still yield an unknown error with the %2Bs replaced with %20s in the parameter URL.

@steverep
Copy link
Member

So there's definitely at least one bug in that generator I've noticed. The reason it reports the %20 encoded URL as an error is because the HTML input has a type of "text" instead of "url". That should be fixed.

@steverep
Copy link
Member

The generator also simply does not create the my HA link correctly. The search parameter should look like:

...=https%3A%2F%2Fraw.githubusercontent.com%2Fdinki%2FView-Assist%2Fmain%2FView%2520Assist%2520custom%2520sentences%2FTravel%2520Times%2520by%2520Waze%2Fblueprint-traveltimesbywaze.yaml

In other words, it should just percent encode the % in %20.

@steverep
Copy link
Member

I've transferred this to the correct repo and assigned myself. Fix is easy enough and I'll get to it shortly. In the meantime, just replace any "+" with "%2520".

@steverep steverep self-assigned this Aug 28, 2024
@changeling
Copy link
Author

changeling commented Aug 28, 2024

Thank you for taking this on, Steve. It's much appreciated.

And thanks for moving this, and identifying the repo it belongs to. My apologies for my lack of familiarity with the codebase and where which issue belongs. And now I know.

@dinki
Copy link

dinki commented Aug 28, 2024

@steverep Yes thank you for workin gon this. I attempted to do as you suggested with the "+" with "%2520" and came up with this:

[![Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.](https://my.home-assistant.io/badges/blueprint_import.svg)](https://my.home-assistant.io/redirect/blueprint_import/?blueprint_url=https%3A%2F%2Fraw.githubusercontent.com%2Fdinki%2FView-Assist%2Fmain%2FView%2520Assist%2520custom%2520sentences%2FTravel%2520Times%2520by%2520Waze%2Fblueprint-traveltimesbywaze.yaml)

When I click the link I get a popup saying "my.home-assistant.io says Invalid parameters given" . Sorry for not fully understanding but should this replacement work as-is right now or is it dependent on you putting in your fix?

@changeling
Copy link
Author

Just checking on the status of this issue.

@dinki
Copy link

dinki commented Sep 6, 2024

I've transferred this to the correct repo and assigned myself. Fix is easy enough and I'll get to it shortly. In the meantime, just replace any "+" with "%2520".

Hi @steverep . Sorry to be a pain but this breaking change is posing some issues with my project as it is dependent on these blueprints and all of my urls have spaces in them. Should I work towards restructuring my GH to not have spaces to get around this issue or do you think a fix may be available relatively soon? Thanks again.

@changeling
Copy link
Author

Checking the status of this.

@silamon
Copy link

silamon commented Sep 10, 2024

There's no need to keep posting in this thread for statusses. It's a community driven project, so contributions are mostly done in free time.

@paperh8rrr
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants
@changeling @dinki @steverep @silamon @paperh8rrr and others