mirror of
				https://github.com/explosion/spaCy.git
				synced 2025-11-04 01:48:04 +03:00 
			
		
		
		
	prevent rewriting an already raw URL (#11810)
This commit is contained in:
		
							parent
							
								
									7e684ad691
								
							
						
					
					
						commit
						caa9efad59
					
				| 
						 | 
					@ -189,7 +189,11 @@ def convert_asset_url(url: str) -> str:
 | 
				
			||||||
    RETURNS (str): The converted URL.
 | 
					    RETURNS (str): The converted URL.
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    # If the asset URL is a regular GitHub URL it's likely a mistake
 | 
					    # If the asset URL is a regular GitHub URL it's likely a mistake
 | 
				
			||||||
    if re.match(r"(http(s?)):\/\/github.com", url) and "releases/download" not in url:
 | 
					    if (
 | 
				
			||||||
 | 
					        re.match(r"(http(s?)):\/\/github.com", url)
 | 
				
			||||||
 | 
					        and "releases/download" not in url
 | 
				
			||||||
 | 
					        and "/raw/" not in url
 | 
				
			||||||
 | 
					    ):
 | 
				
			||||||
        converted = url.replace("github.com", "raw.githubusercontent.com")
 | 
					        converted = url.replace("github.com", "raw.githubusercontent.com")
 | 
				
			||||||
        converted = re.sub(r"/(tree|blob)/", "/", converted)
 | 
					        converted = re.sub(r"/(tree|blob)/", "/", converted)
 | 
				
			||||||
        msg.warn(
 | 
					        msg.warn(
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user