forked from MapComplete/MapComplete
		
	Small usability improvement: don't add the trailing '/' to URLs if they weren't typed
This commit is contained in:
		
							parent
							
								
									223fada5b3
								
							
						
					
					
						commit
						03f3045a82
					
				
					 1 changed files with 6 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -145,7 +145,12 @@ export default class ValidatedTextField {
 | 
			
		|||
                    for (const dontLike of blacklistedTrackingParams) {
 | 
			
		||||
                        url.searchParams.delete(dontLike)
 | 
			
		||||
                    }
 | 
			
		||||
                    return url.toString();
 | 
			
		||||
                    let cleaned = url.toString();
 | 
			
		||||
                    if(cleaned.endsWith("/") && !str.endsWith("/")){
 | 
			
		||||
                        // Do not add a trailing '/' if it wasn't typed originally
 | 
			
		||||
                        cleaned = cleaned.substr(0, cleaned.length - 1)
 | 
			
		||||
                    }
 | 
			
		||||
                    return cleaned;
 | 
			
		||||
                } catch (e) {
 | 
			
		||||
                    console.error(e)
 | 
			
		||||
                    return undefined;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue