10
Views
11
Comments
Uncaught URIError: URI malformed at decodeURIComponent
Question
Application Type
Reactive

I have a reactive application.

When try to access URL like below:
https://{URL_APP}?param=N5dnw7%%2F8ozUoLAfjefiCcTDV8HimtJokHCYTq%2BUiMZpIN1baEaGiBUkPH40HsmWeZU%3D

The error happen and the web page display white - blank. How can I handle this error?

In case a user intentionally enters the wrong URL and causes an error to occur, how to handle it?

error.JPG
2024-12-02 13-16-47
Vipin Yadav

Hi,

The issue arises due to the encoding of the URL parameters. Special characters like % and = might be incorrectly encoded or decoded, leading to the blank page.

You can use EncodeUrl().

Thanks,

Vipin Yadav 

2024-12-02 13-16-47
Vipin Yadav

You can pass url like below  - 

"https://{URL_APP}?param="+EncodeUrl(param)


Thanks,

Vipin Yadav

2024-01-12 11-52-52
PhucHoang

Thank you.

But do you have example OML?
This error happen in Navigation.js of Outsystems. So I can't check it in onInitialized or onRender event of the screen.

In case a user intentionally enters the wrong URL and causes an error to occur, how to handle it?

Thanks,
Phuc

2024-12-02 13-16-47
Vipin Yadav

Hi @PhucHoang,

If possible, please share your OML file so that I can make the necessary changes and update you. 

Thanks,

Vipin Yadav


2024-01-12 11-52-52
PhucHoang

OK.
Let me share the OML.

The invaid URL: https://{URL}/DemoAPp/Home?Id=N5dnw7%%2F8ozUoLAfjefiCcTDV8HimtJokHCYTq%2BUiMZpIN1baEaGiBUkPH40HsmWeZU%3D


DemoApp.oml
Screenshot 2025-01-14 at 13.32.55.png
2024-12-02 13-16-47
Vipin Yadav


The error with encoding the given string (Id=N5dnw7%%2F8ozUoLAfjefiCcTDV8HimtJokHCYTq%2BUiMZpIN1baEaGiBUkPH40HsmWeZU%3D) occurs because the string contains invalid or double-encoded characters that are causing issues during the encoding or decoding process. Specifically, the %% is problematic because it's neither a valid encoded value nor an acceptable character for URLs. 

Thanks,

Vipin Yadav

DemoApp.oml
2024-01-12 11-52-52
PhucHoang

Thanks for your reply,

It seems you are misunderstanding my point. I have attached the recording of the issue that I need to resolve. When intentionally accessing an incorrect URL, an error occurs. I want to display a more user-friendly error message or something similar.


Screen Recording 2025-01-14 at 15.18.40.mov
2024-01-12 11-52-52
PhucHoang

Hi @Vipin Yadav , do you have any solution to resolve it?
Thanks,

2024-12-02 13-16-47
Vipin Yadav

No, Brother. It seems there is an issue with the encoding or decoding process. Maybe other community members can assist you with this.

Thanks,

Vipin Yadav

2020-07-21 19-28-50
Rajat Agrawal
Champion

Hi @PhucHoang 

The error occurs when the decodeURIComponent() function in JavaScript is called on a URL-encoded string that is not properly encoded or contains invalid characters. 

The main cause of the URI malformed error is likely due to double encoding in the URL parameter. Implementing double decoding, using safe decoding methods, and ensuring that URLs are properly encoded can help resolve this issue and prevent the page from failing silently with a blank screen. 

%%2F appears in your URL may be the reason, as it might indicate double encoding. This could be the root cause of the error. 

If the URL parameter is being double-encoded, the solution is to decode it twice.

Regards ,

Rajat

2024-01-12 11-52-52
PhucHoang

HI @Rajat Agrawal 

In case a user intentionally enters the wrong URL and causes an error to occur, how to handle it?

Thanks,
Phuc

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.