t3rm1n4l / megacmd

A command-line client for mega.co.nz storage service
456 stars 74 forks source link

Name: MALFORMED_ATTRIBUTES #52

Open matbech opened 10 years ago

matbech commented 10 years ago

After uploading a 16GB file the file on the mega server has the following name: MALFORMED_ATTRIBUTES

There is no problem uploading smaller files.

megacmd: Version : 0.011 Platform: Windows

I was looking at the UploadFile function and noticed some potential issues:

sorted_chunks := []int{} chunks := getChunkSizes(int(fileSize)) .. chk_url := fmt.Sprintf("%s/%d", uploadUrl, chk_start)

The same issues can be found in the DownloadFile function: chunk_url := fmt.Sprintf("%s/%d-%d", resourceUrl, chk_start, chk_start+chk_size-1) ...

You probably want to use uint64 instead of ints.

g-goessel commented 10 years ago

I am also having this issue, @matbech have you tried using uint64 ?

g-goessel commented 10 years ago

Be aware that the posted binaries are outdated (at least the linux version is one version old). I don't have any issue after building from git

matbech commented 10 years ago

It cannot work on 32-bit because go's int is 32-bit. On 64-bit the size of the int is 64-bit: Reference: http://golang.org/ref/spec#Numeric_types Conclusion: int needs to be replaced with uint64.

The Sprintf "verbs" are correct though because %d is different from C's printf version: "There is no 'u' flag. Integers are printed unsigned if they have unsigned type. Similarly, there is no need to specify the size of the operand (int8, int64)." Reference: http://golang.org/pkg/fmt/

Let's hope to author finds some time to fix this and provide new binaries.

repeatingmeme commented 9 years ago

this happens for me if the file name is over 16 characters, when its lower than that it seems to work fine

I dont know why, but thats what ive observed