mirror of
				https://github.com/Quiq/docker-registry-ui
				synced 2025-10-31 18:33:17 +08:00 
			
		
		
		
	Merge pull request #12 from drExciter/url_encode_repos
URL encode repo variable in templates to support images with slash in…
This commit is contained in:
		
							
								
								
									
										11
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								main.go
									
									
									
									
									
								
							| @@ -122,6 +122,17 @@ func main() { | |||||||
| 		} | 		} | ||||||
| 		return res | 		return res | ||||||
| 	}) | 	}) | ||||||
|  | 	view.AddGlobal("url_encoded_path", func(m interface{}) string { | ||||||
|  | 		return url.PathEscape(m.(string)) | ||||||
|  |  | ||||||
|  | 	}) | ||||||
|  | 	view.AddGlobal("url_decoded_path", func(m interface{}) string { | ||||||
|  | 		res, err := url.PathUnescape(m.(string)) | ||||||
|  | 		if err != nil { | ||||||
|  | 			return m.(string) | ||||||
|  | 		} | ||||||
|  | 		return res | ||||||
|  | 	}) | ||||||
| 	e := echo.New() | 	e := echo.New() | ||||||
| 	e.Renderer = &template{View: view} | 	e.Renderer = &template{View: view} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -48,7 +48,7 @@ | |||||||
|     <tbody> |     <tbody> | ||||||
|         {{range repo := repos}} |         {{range repo := repos}} | ||||||
|             <tr> |             <tr> | ||||||
|                 <td><a href="/{{ namespace }}/{{ repo }}">{{ repo }}</a></td> |                 <td><a href="/{{ namespace }}/{{ repo |url_encoded_path }}">{{ repo }}</a></td> | ||||||
|                 <td>{{ tagCounts[namespace+"/"+repo] }}</td> |                 <td>{{ tagCounts[namespace+"/"+repo] }}</td> | ||||||
|             </tr> |             </tr> | ||||||
|         {{end}} |         {{end}} | ||||||
|   | |||||||
| @@ -8,7 +8,7 @@ | |||||||
|     {{if namespace != "library"}} |     {{if namespace != "library"}} | ||||||
|     <li><a href="/{{ namespace }}">{{ namespace }}</a></li> |     <li><a href="/{{ namespace }}">{{ namespace }}</a></li> | ||||||
|     {{end}} |     {{end}} | ||||||
|     <li><a href="/{{ namespace }}/{{ repo }}">{{ repo }}</a></li> |     <li><a href="/{{ namespace }}/{{ repo }}">{{ repo |url_decoded_path }}</a></li> | ||||||
|     <li class="active">{{ tag }}</li> |     <li class="active">{{ tag }}</li> | ||||||
| </ol> | </ol> | ||||||
| <table class="table table-striped table-bordered"> | <table class="table table-striped table-bordered"> | ||||||
|   | |||||||
| @@ -33,7 +33,7 @@ | |||||||
|     {{if namespace != "library"}} |     {{if namespace != "library"}} | ||||||
|     <li><a href="/{{ namespace }}">{{ namespace }}</a></li> |     <li><a href="/{{ namespace }}">{{ namespace }}</a></li> | ||||||
|     {{end}} |     {{end}} | ||||||
|     <li class="active">{{ repo }}</li> |     <li class="active">{{ repo |url_decoded_path }}</li> | ||||||
| </ol> | </ol> | ||||||
|  |  | ||||||
| <table id="datatable" class="table table-striped table-bordered"> | <table id="datatable" class="table table-striped table-bordered"> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Roman Vynar
					Roman Vynar