[PR #944] [MERGED] check for empty string on malformed URL #2676

Closed
opened 2025-11-26 23:22:33 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/944
Author: @kspearrin
Created: 6/1/2020
Status: Merged
Merged: 6/1/2020
Merged by: @kspearrin

Base: masterHead: emptystringcheck


📝 Commits (2)

  • 9a2dd4f treat empty string host as null
  • 3c22121 use string.IsNullOrEmpty

📊 Changes

1 file changed (+3 additions, -2 deletions)

View changed files

📝 src/Core/Utilities/CoreHelpers.cs (+3 -2)

📄 Description

When parsing a URL string that meets the proper format to construct a URL, but the hostname/host is malformed, you end up with an empty string for the hostname/host rather than null. We handle the null condition when comparing URLs for autofill, but not an empty string. This leads to two malformed hostnames/hosts being able to match ('' === '') == true. This PR ensures that hostname/host parsing always treats an empty string the same as null.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/bitwarden/android/pull/944 **Author:** [@kspearrin](https://github.com/kspearrin) **Created:** 6/1/2020 **Status:** ✅ Merged **Merged:** 6/1/2020 **Merged by:** [@kspearrin](https://github.com/kspearrin) **Base:** `master` ← **Head:** `emptystringcheck` --- ### 📝 Commits (2) - [`9a2dd4f`](https://github.com/bitwarden/android/commit/9a2dd4f86d6bc23b6799fe143178172b80b2e277) treat empty string host as null - [`3c22121`](https://github.com/bitwarden/android/commit/3c22121661172017cd7da3d5517a2fb8c906b4f6) use `string.IsNullOrEmpty` ### 📊 Changes **1 file changed** (+3 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/Core/Utilities/CoreHelpers.cs` (+3 -2) </details> ### 📄 Description When parsing a URL string that meets the proper format to construct a URL, but the hostname/host is malformed, you end up with an empty string for the hostname/host rather than `null`. We handle the `null` condition when comparing URLs for autofill, but not an empty string. This leads to two malformed hostnames/hosts being able to match `('' === '') == true`. This PR ensures that hostname/host parsing always treats an empty string the same as `null`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-26 23:22:33 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/android#2676