Skip to content

Commit 2602cf8

Browse files
committed
fix: handle optional % prefix before hex payload in masked inspect URLs
Some Steam clients prepend a literal % before the hex payload in masked inspect URLs (e.g. csgo_econ_action_preview%20%FDED5D6F...). This was causing deserialization to fail with "Payload too short or invalid hex".
1 parent 37234df commit 2602cf8

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/InspectLink.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public static function deserialize(string $hexOrUrl): ItemPreviewData
102102
public static function isMasked(string $link): bool
103103
{
104104
// Pure hex blob (new steam://run/730// format)
105-
if (preg_match('/csgo_econ_action_preview(?:%20|\s)[0-9A-Fa-f]{10,}$/i', $link)) {
105+
if (preg_match('/csgo_econ_action_preview(?:%20|\s)%?[0-9A-Fa-f]{10,}$/i', $link)) {
106106
return true;
107107
}
108108
// Hybrid: S/A/D prefix with hex proto after D
@@ -137,7 +137,7 @@ private static function extractHex(string $input): string
137137

138138
// Pure masked format: csgo_econ_action_preview%20<hexblob> (no S/A/M prefix).
139139
// Also handles payloads whose first hex character happens to be A.
140-
if (preg_match('/csgo_econ_action_preview(?:%20|\s|\+)([0-9A-Fa-f]{10,})$/i', $stripped, $m)) {
140+
if (preg_match('/csgo_econ_action_preview(?:%20|\s|\+)%?([0-9A-Fa-f]{10,})$/i', $stripped, $m)) {
141141
return $m[1];
142142
}
143143

0 commit comments

Comments
 (0)