fedimbed: replace urlObj when redirecting
This commit is contained in:
		
							parent
							
								
									a0a218ce67
								
							
						
					
					
						commit
						86a8bd33a8
					
				
					 1 changed files with 4 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -29,7 +29,7 @@ const PLATFORM_COLORS = {
 | 
			
		|||
 | 
			
		||||
const domainCache = new Map();
 | 
			
		||||
async function resolvePlatform(url) {
 | 
			
		||||
  const urlObj = new URL(url);
 | 
			
		||||
  let urlObj = new URL(url);
 | 
			
		||||
  if (domainCache.has(urlObj.hostname)) return domainCache.get(urlObj.hostname);
 | 
			
		||||
 | 
			
		||||
  const probe = await fetch(urlObj.origin + "/.well-known/nodeinfo", {
 | 
			
		||||
| 
						 | 
				
			
			@ -107,6 +107,7 @@ async function processUrl(msg, url) {
 | 
			
		|||
      if (url.startsWith("/")) {
 | 
			
		||||
        url = urlObj.origin + url;
 | 
			
		||||
      }
 | 
			
		||||
      urlObj = new URL(url);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (PATH_REGEX.pleroma2.test(urlObj.pathname)) {
 | 
			
		||||
| 
						 | 
				
			
			@ -147,6 +148,8 @@ async function processUrl(msg, url) {
 | 
			
		|||
          });
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    } else {
 | 
			
		||||
      logger.error("fedimbed", `Redirect from /object did not give us /notice. (${urlObj.pathname})`);
 | 
			
		||||
    }
 | 
			
		||||
  } else {
 | 
			
		||||
    content = postData.content;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue