mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-04 10:44:12 +01:00 
			
		
		
		
	#2556 handle space in image URL
This commit is contained in:
		
							parent
							
								
									ddf9fa06c7
								
							
						
					
					
						commit
						8e40f86d2c
					
				@ -3,7 +3,7 @@ Gogs - Go Git Service [
 | 
			
		||||
 | 
			
		||||
##### Current version: 0.8.29
 | 
			
		||||
##### Current version: 0.8.30
 | 
			
		||||
 | 
			
		||||
| Web | UI  | Preview  |
 | 
			
		||||
|:-------------:|:-------:|:-------:|
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										2
									
								
								gogs.go
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								gogs.go
									
									
									
									
									
								
							@ -17,7 +17,7 @@ import (
 | 
			
		||||
	"github.com/gogits/gogs/modules/setting"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const APP_VER = "0.8.29.0204"
 | 
			
		||||
const APP_VER = "0.8.30.0204"
 | 
			
		||||
 | 
			
		||||
func init() {
 | 
			
		||||
	runtime.GOMAXPROCS(runtime.NumCPU())
 | 
			
		||||
 | 
			
		||||
@ -157,6 +157,8 @@ func (options *CustomRender) ListItem(out *bytes.Buffer, text []byte, flags int)
 | 
			
		||||
var (
 | 
			
		||||
	svgSuffix         = []byte(".svg")
 | 
			
		||||
	svgSuffixWithMark = []byte(".svg?")
 | 
			
		||||
	spaceBytes        = []byte(" ")
 | 
			
		||||
	spaceEncodedBytes = []byte("%20")
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func (r *CustomRender) Image(out *bytes.Buffer, link []byte, title []byte, alt []byte) {
 | 
			
		||||
@ -172,7 +174,8 @@ func (r *CustomRender) Image(out *bytes.Buffer, link []byte, title []byte, alt [
 | 
			
		||||
			if link[0] != '/' {
 | 
			
		||||
				prefix += "/"
 | 
			
		||||
			}
 | 
			
		||||
			link = []byte(prefix + string(link))
 | 
			
		||||
			link = bytes.Replace([]byte((prefix + string(link))), spaceBytes, spaceEncodedBytes, -1)
 | 
			
		||||
			fmt.Println(333, string(link))
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1 +1 @@
 | 
			
		||||
0.8.29.0204
 | 
			
		||||
0.8.30.0204
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user