mirror of
https://github.com/dergigi/boris.git
synced 2025-12-17 06:34:24 +01:00
debug: add key mismatch detection to identify format differences
- Check if encoded value from regex matches Map keys - Log full comparison when mismatch detected - Will help identify if regex capture group format differs from Map storage format
This commit is contained in:
@@ -324,9 +324,6 @@ export function replaceNostrUrisInMarkdownWithProfileLabels(
|
|||||||
console.log(`[profile-loading-debug][nostr-uri-resolve] Loading keys:`, Array.from(profileLoading.entries()).filter(([, l]) => l).map(([k]) => k.slice(0, 16) + '...'))
|
console.log(`[profile-loading-debug][nostr-uri-resolve] Loading keys:`, Array.from(profileLoading.entries()).filter(([, l]) => l).map(([k]) => k.slice(0, 16) + '...'))
|
||||||
|
|
||||||
return replaceNostrUrisSafely(markdown, (encoded) => {
|
return replaceNostrUrisSafely(markdown, (encoded) => {
|
||||||
console.log(`[profile-loading-debug][nostr-uri-resolve] Processing encoded="${encoded.slice(0, 30)}..."`)
|
|
||||||
console.log(`[profile-loading-debug][nostr-uri-resolve] Map keys sample:`, Array.from(profileLoading.keys()).slice(0, 3).map(k => k.slice(0, 30) + '...'))
|
|
||||||
|
|
||||||
const link = createNostrLink(encoded)
|
const link = createNostrLink(encoded)
|
||||||
|
|
||||||
// Check if we have a resolved profile name
|
// Check if we have a resolved profile name
|
||||||
@@ -347,7 +344,17 @@ export function replaceNostrUrisInMarkdownWithProfileLabels(
|
|||||||
if (decoded.type === 'npub' || decoded.type === 'nprofile') {
|
if (decoded.type === 'npub' || decoded.type === 'nprofile') {
|
||||||
const hasLoading = profileLoading.has(encoded)
|
const hasLoading = profileLoading.has(encoded)
|
||||||
const isLoading = profileLoading.get(encoded)
|
const isLoading = profileLoading.get(encoded)
|
||||||
console.log(`[profile-loading-debug][nostr-uri-resolve] ${encoded.slice(0, 16)}... type=${decoded.type}, hasLoading=${hasLoading}, isLoading=${isLoading}`)
|
|
||||||
|
// Debug: Check if there's a key mismatch
|
||||||
|
if (!hasLoading && profileLoading.size > 0) {
|
||||||
|
// Check if there's a similar key (for debugging)
|
||||||
|
const matchingKey = Array.from(profileLoading.keys()).find(k => k.includes(encoded.slice(0, 20)) || encoded.includes(k.slice(0, 20)))
|
||||||
|
if (matchingKey) {
|
||||||
|
console.log(`[profile-loading-debug][nostr-uri-resolve] KEY MISMATCH: encoded="${encoded.slice(0, 50)}..." vs Map key="${matchingKey.slice(0, 50)}..."`)
|
||||||
|
console.log(`[profile-loading-debug][nostr-uri-resolve] Full encoded length=${encoded.length}, Full key length=${matchingKey.length}`)
|
||||||
|
console.log(`[profile-loading-debug][nostr-uri-resolve] encoded === key? ${encoded === matchingKey}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (hasLoading && isLoading) {
|
if (hasLoading && isLoading) {
|
||||||
const label = getNostrUriLabel(encoded)
|
const label = getNostrUriLabel(encoded)
|
||||||
|
|||||||
Reference in New Issue
Block a user