-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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: empty screen when URI is malformed #29479
bug: empty screen when URI is malformed #29479
Comments
Hello @legendar thanks for opening up this issue. I can confirm the issue with the malformed URI. Ionic Framework should not be causing an uncaught exception when decoding the URI. We can handle this exception and fallback the config object in these scenarios.
This should be a concern of your application layer. When the location changes, attempt to decode the query parameters and catch any invalid cases that occur to handle in your React error boundaries.
There is currently no way to opt-out of this behavior. |
I see this in the code. However, what I mean is that we want to have a way to disable this behavior. Should I create a separate ticket for it? |
@legendar yes, I would create a feature request around that specific API request to customize (opt-out) of that behavior. New APIs will be in a minor, but the malformed URI we can address in a patch. |
Issue number: resolves #29479 --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> If an application includes a malformed URI, an Ionic Framework can "crash" due to an uncaught exception in parsing the URI for the Ionic config. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Handle the malformed URI fallback if the config cannot be determined - Added unit tests for this case ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change: 1. Describe the impact and migration path for existing applications below. 2. Update the BREAKING.md file with the breaking change. 3. Add "BREAKING CHANGE: [...]" to the commit description when merging. See https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer for more information. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. -->
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out. |
Prerequisites
Ionic Framework Version
v7.x, v8.x
Current Behavior
When the URI is malformed, Ionic throws the "URI malformed" error, resulting in an empty screen being rendered. We want to handle this error using a React error boundary and render our standard error message instead. The issue arises when Ionic attempts to get configuration from the URL: https://github.com/ionic-team/ionic-framework/blob/main/core/src/global/ionic-global.ts#L43.
Additionaly, the second issue is: How can we disable this behavior, as we don't want to allow reconfiguration of our app from the URL in production?"
Expected Behavior
When the URI is malformed, Ionic should not drop an error. Instead, it should provide a way to catch this error or ignore it.
Steps to Reproduce
?test=%
. E.g. https://www.pandaexpress.com/location?test=%Note that in development mode, you're more likely to see the standard error message from Vite.
Code Reproduction URL
https://www.pandaexpress.com/location?test=%
Ionic Info
Ionic:
Ionic CLI : 7.2.0
Ionic Framework : @ionic/react 7.5.8
Capacitor:
Capacitor CLI : 5.6.0
@capacitor/android : not installed
@capacitor/core : 5.6.0
@capacitor/ios : not installed
Utility:
cordova-res : not installed globally
native-run (update available: 2.0.1) : 2.0.0
System:
NodeJS : v18.15.0
npm : 9.5.0
OS : Linux 5.15
Additional Information
No response
The text was updated successfully, but these errors were encountered: