@ -26,7 +26,6 @@ import (
"net/url"
"net/url"
"os"
"os"
"path/filepath"
"path/filepath"
"regexp"
"strings"
"strings"
"time"
"time"
@ -395,10 +394,6 @@ func (s *siaObjects) ListObjects(bucket string, prefix string, marker string, de
}
}
func ( s * siaObjects ) GetObject ( bucket string , object string , startOffset int64 , length int64 , writer io . Writer ) error {
func ( s * siaObjects ) GetObject ( bucket string , object string , startOffset int64 , length int64 , writer io . Writer ) error {
if ! isValidObjectName ( object ) {
return errors . Trace ( ObjectNameInvalid { bucket , object } )
}
dstFile := pathJoin ( s . TempDir , mustGetUUID ( ) )
dstFile := pathJoin ( s . TempDir , mustGetUUID ( ) )
defer fsRemoveFile ( dstFile )
defer fsRemoveFile ( dstFile )
@ -473,11 +468,6 @@ func (s *siaObjects) GetObjectInfo(bucket string, object string) (ObjectInfo, er
// PutObject creates a new object with the incoming data,
// PutObject creates a new object with the incoming data,
func ( s * siaObjects ) PutObject ( bucket string , object string , data * hash . Reader , metadata map [ string ] string ) ( objInfo ObjectInfo , err error ) {
func ( s * siaObjects ) PutObject ( bucket string , object string , data * hash . Reader , metadata map [ string ] string ) ( objInfo ObjectInfo , err error ) {
// Check the object's name first
if ! isValidObjectName ( object ) {
return objInfo , errors . Trace ( ObjectNameInvalid { bucket , object } )
}
bufSize := int64 ( readSizeV1 )
bufSize := int64 ( readSizeV1 )
size := data . Size ( )
size := data . Size ( )
if size > 0 && bufSize > size {
if size > 0 && bufSize > size {
@ -527,12 +517,6 @@ type siaObjectInfo struct {
UploadProgress float64 ` json:"uploadprogress" `
UploadProgress float64 ` json:"uploadprogress" `
}
}
// isValidObjectName returns whether or not the objectName provided is suitable for Sia
func isValidObjectName ( objectName string ) bool {
reg , _ := regexp . Compile ( "[^a-zA-Z0-9., _/\\\\+-]+" )
return objectName == reg . ReplaceAllString ( objectName , "" )
}
type renterFiles struct {
type renterFiles struct {
Files [ ] siaObjectInfo ` json:"files" `
Files [ ] siaObjectInfo ` json:"files" `
}
}