Skip to content

Commit ecdc0aa

Browse files
committed
unwrap FB messenger links
1 parent b2a58f2 commit ecdc0aa

File tree

4 files changed

+23
-7
lines changed

4 files changed

+23
-7
lines changed

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.5.8] - 2024-08-15
9+
10+
### Added
11+
12+
- Unwrap URLs (Facebook Messenger, Office 365 Safe Links). Fixes #202
13+
814
## [0.5.7] - 2024-07-27
915

1016
### Fixed
@@ -303,7 +309,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
303309

304310
Initial Release
305311

306-
[unreleased]: https://github.com/Browsers-software/browsers/compare/0.5.7...HEAD
312+
[unreleased]: https://github.com/Browsers-software/browsers/compare/0.5.8...HEAD
313+
314+
[0.5.8]: https://github.com/Browsers-software/browsers/releases/tag/0.5.8
307315

308316
[0.5.7]: https://github.com/Browsers-software/browsers/releases/tag/0.5.7
309317

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "browsers"
3-
version = "0.5.7"
3+
version = "0.5.8"
44
authors = ["Madis Liias <[email protected]>"]
55
edition = "2021"
66
description = "Browsers"

src/lib.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -625,17 +625,25 @@ pub fn unwrap_url(url_str: &str, behavioral_settings: &BehavioralConfig) -> Stri
625625
let url = url_maybe.unwrap();
626626

627627
let transformed_url = url.domain().and_then(|domain| {
628-
let is_safelinks = domain
629-
.to_lowercase()
630-
.ends_with("safelinks.protection.outlook.com");
631-
return if is_safelinks {
628+
let domain_lowercase = domain.to_lowercase();
629+
630+
return if domain_lowercase.ends_with("safelinks.protection.outlook.com") {
632631
let query_pairs: Parse = url.query_pairs();
633632

634633
let target_url_maybe: Option<String> = query_pairs
635634
.into_iter()
636635
.find(|(key, _)| key == "url")
637636
.map(|(_, value)| value.to_string());
638637

638+
target_url_maybe
639+
} else if domain_lowercase.ends_with("l.messenger.com") {
640+
let query_pairs: Parse = url.query_pairs();
641+
642+
let target_url_maybe: Option<String> = query_pairs
643+
.into_iter()
644+
.find(|(key, _)| key == "u")
645+
.map(|(_, value)| value.to_string());
646+
639647
target_url_maybe
640648
} else {
641649
None

0 commit comments

Comments
 (0)