mirror of
				https://github.com/minio/minio.git
				synced 2025-10-30 00:05:02 -04:00 
			
		
		
		
	Merge pull request #1079 from harshavardhana/implement-stat
web: GetObjectURL should check if file exists before generating URL.
This commit is contained in:
		
						commit
						729e032a50
					
				| @ -292,7 +292,7 @@ func serverMain(c *cli.Context) { | |||||||
| 	minFreeDisk = 10 | 	minFreeDisk = 10 | ||||||
| 
 | 
 | ||||||
| 	args := c.Args() | 	args := c.Args() | ||||||
| 	for len(args) >= 1 { | 	for len(args) >= 2 { | ||||||
| 		switch args.First() { | 		switch args.First() { | ||||||
| 		case "min-free-disk": | 		case "min-free-disk": | ||||||
| 			if minFreeDiskSet { | 			if minFreeDiskSet { | ||||||
|  | |||||||
| @ -157,6 +157,13 @@ func (web *WebAPI) GetObjectURL(r *http.Request, args *GetObjectURLArgs, reply * | |||||||
| 	if !isAuthenticated(r) { | 	if !isAuthenticated(r) { | ||||||
| 		return errUnAuthorizedRequest | 		return errUnAuthorizedRequest | ||||||
| 	} | 	} | ||||||
|  | 
 | ||||||
|  | 	// See if object exists. | ||||||
|  | 	_, e := web.Client.StatObject(args.BucketName, args.ObjectName) | ||||||
|  | 	if e != nil { | ||||||
|  | 		return e | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	targetHost, err := getTargetHost(web.apiAddress, args.TargetHost) | 	targetHost, err := getTargetHost(web.apiAddress, args.TargetHost) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return probe.WrapError(err) | 		return probe.WrapError(err) | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user