Fix QR scan stripping scheme from product URL
LookupAsync builds SpecPageUrl from the ProductUrlTemplate via TryBuildDirectUrl. If the template is stored without a scheme the link is scheme-less and browsers treat it as relative, appending it to the app URL. The scanned QR URL is always fully-qualified and always the correct product page (it came from the manufacturer's bag), so use it unconditionally as SpecPageUrl on the pattern-matched QR path instead of only when SpecPageUrl was null. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -946,7 +946,10 @@ public class InventoryController : Controller
|
|||||||
if (!string.IsNullOrWhiteSpace(urlMfr))
|
if (!string.IsNullOrWhiteSpace(urlMfr))
|
||||||
{
|
{
|
||||||
aiResult = await _aiLookupService.LookupAsync(urlMfr, urlColor, null, urlPart);
|
aiResult = await _aiLookupService.LookupAsync(urlMfr, urlColor, null, urlPart);
|
||||||
if (aiResult.Success && aiResult.SpecPageUrl == null)
|
// The scanned QR URL is always the authoritative product page link — it came
|
||||||
|
// directly from the manufacturer's bag and is always fully-qualified. Overwrite
|
||||||
|
// whatever LookupAsync returned (which may be a scheme-less path from the template).
|
||||||
|
if (aiResult.Success)
|
||||||
aiResult.SpecPageUrl = qrUrl;
|
aiResult.SpecPageUrl = qrUrl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user