Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/go/0chain.net/blobbercore/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func GetMetaDataStore() *datastore.Store {
func SetupHandlers(r *mux.Router) {
//object operations
r.HandleFunc("/v1/file/upload/{allocation}", common.UserRateLimit(common.ToJSONResponse(WithConnection(UploadHandler))))
r.HandleFunc("/v1/file/download/{allocation}", common.UserRateLimit(common.ToByteStream(WithConnection(DownloadHandler))))
r.HandleFunc("/v1/file/download/{allocation}", common.UserRateLimit(common.ToByteStream(WithConnection(DownloadHandler)))).Methods("POST")
r.HandleFunc("/v1/file/rename/{allocation}", common.UserRateLimit(common.ToJSONResponse(WithConnection(RenameHandler))))
r.HandleFunc("/v1/file/copy/{allocation}", common.UserRateLimit(common.ToJSONResponse(WithConnection(CopyHandler))))
r.HandleFunc("/v1/file/attributes/{allocation}", common.UserRateLimit(common.ToJSONResponse(WithConnection(UpdateAttributesHandler))))
Expand Down
1 change: 0 additions & 1 deletion code/go/0chain.net/blobbercore/handler/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@ func GetAuthTicketForEncryptedFile(allocationID string, remotePath string, fileH
at.ClientID = clientID
at.FileName = remotePath
at.FilePathHash = fileHash
at.ContentHash = "content_hash"
at.RefType = fileref.FILE
timestamp := int64(common.Now())
at.Expiration = timestamp + 7776000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,6 @@ func (fsh *StorageHandler) DownloadFile(
ctx context.Context,
r *http.Request,
) (resp interface{}, err error) {
if r.Method == "GET" {
return nil, common.NewError("download_file",
"invalid method used (GET), use POST instead")
}

// get client and allocation ids
var (
Expand Down Expand Up @@ -319,7 +315,7 @@ func (fsh *StorageHandler) DownloadFile(
}

// we only check content hash if its authticket is referring to a file
if authToken.RefType == zfileref.FILE && authToken.ContentHash != fileref.ContentHash {
if authToken.RefType == zfileref.FILE && authToken.ActualFileHash != fileref.ActualFileHash {
return nil, errors.New("content hash does not match the requested file content hash")
}

Expand Down
6 changes: 3 additions & 3 deletions code/go/0chain.net/blobbercore/readmarker/entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ type AuthTicket struct {
OwnerID string `json:"owner_id"`
AllocationID string `json:"allocation_id"`
FilePathHash string `json:"file_path_hash"`
ContentHash string `json:"content_hash"`
ActualFileHash string `json:"actual_file_hash"`
FileName string `json:"file_name"`
RefType string `json:"reference_type"`
Expiration common.Timestamp `json:"expiration"`
Timestamp common.Timestamp `json:"timestamp"`
ReEncryptionKey string `json:"re_encryption_key"`
Signature string `json:"signature"`
Encrypted bool `json:"encrypted"`
Encrypted bool `json:"encrypted"`
}

func (rm *AuthTicket) GetHashData() string {
hashData := fmt.Sprintf("%v:%v:%v:%v:%v:%v:%v:%v:%v:%v:%v", rm.AllocationID, rm.ClientID, rm.OwnerID, rm.FilePathHash, rm.FileName, rm.RefType, rm.ReEncryptionKey, rm.Expiration, rm.Timestamp, rm.ContentHash, rm.Encrypted)
hashData := fmt.Sprintf("%v:%v:%v:%v:%v:%v:%v:%v:%v:%v:%v", rm.AllocationID, rm.ClientID, rm.OwnerID, rm.FilePathHash, rm.FileName, rm.RefType, rm.ReEncryptionKey, rm.Expiration, rm.Timestamp, rm.ActualFileHash, rm.Encrypted)
return hashData
}

Expand Down