web: GetObjectURL should check if file exists before generating URL.

Fixes - https://github.com/minio/miniobrowser/issues/20
This commit is contained in:
Harshavardhana 2016-02-03 00:00:01 -08:00
parent ff0dd38957
commit 64b7da4686
2 changed files with 8 additions and 1 deletions

View File

@ -292,7 +292,7 @@ func serverMain(c *cli.Context) {
minFreeDisk = 10
args := c.Args()
for len(args) >= 1 {
for len(args) >= 2 {
switch args.First() {
case "min-free-disk":
if minFreeDiskSet {

View File

@ -157,6 +157,13 @@ func (web *WebAPI) GetObjectURL(r *http.Request, args *GetObjectURLArgs, reply *
if !isAuthenticated(r) {
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)
if err != nil {
return probe.WrapError(err)