diff --git a/configure.ac b/configure.ac index 58ee59c..93fb370 100644 --- a/configure.ac +++ b/configure.ac @@ -21,7 +21,7 @@ dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) -AC_INIT(cosfs, 1.0.19-beta) +AC_INIT(cosfs, 1.0.20) AC_CONFIG_HEADER([config.h]) AC_CANONICAL_SYSTEM diff --git a/src/s3fs.cpp b/src/s3fs.cpp index fff52f9..60b4e40 100644 --- a/src/s3fs.cpp +++ b/src/s3fs.cpp @@ -1193,7 +1193,7 @@ static int rename_object(const char* from, const char* to) } s3_realpath = get_realpath(from); - meta["x-cos-copy-source"] = urlEncode(service_path + bucket + "-" + appid + get_realpath(s3_realpath.c_str())); + meta["x-cos-copy-source"] = urlEncode(service_path + bucket + "-" + appid + s3_realpath.c_str()); meta["Content-Type"] = S3fsCurl::LookupMimeType(string(to)); meta["x-cos-metadata-directive"] = "REPLACE"; diff --git a/test/move_test.py b/test/move_test.py new file mode 100644 index 0000000..5db913e --- /dev/null +++ b/test/move_test.py @@ -0,0 +1,38 @@ +import os +import random +import shutil +import sys + +mountpoint = sys.argv[1] + +filename = "cosfs_test_%d" % random.randint(0, 1000000) +origin_file = mountpoint + filename + +data = "hello" +# suppose the "multipart_size" is set to 1 MB. +data = '0' * (2 * 1024 * 1024 + 12) +f = open(origin_file, 'w') +f.write(data) +f.flush() + +origin_files = os.listdir(mountpoint) +dest_path = os.getcwd() + "/" + +for g in origin_files: + shutil.move(mountpoint + g, dest_path) + + sz = os.stat(dest_path + g).st_size + os.remove(dest_path + g) + assert sz == len(data), "%d, %d"%(sz, len(data)) + + +data = '0' * (5 * 1024 * 1024 * 1024 + 12) +f = open(origin_file, 'w') +f.write(data) +f.flush() +for g in origin_files: + shutil.move(mountpoint + g, dest_path) + + sz = os.stat(dest_path + g).st_size + os.remove(dest_path + g) + assert sz == len(data), "%d, %d"%(sz, len(data)) \ No newline at end of file