* AVFileController.cs: fix: 修复上传文件的 bug
* AWSUploader.cs: * QiniuUploader.cs:
parent
d339fe9e4e
commit
15e6a5d9c3
|
@ -85,11 +85,10 @@ namespace LeanCloud.Storage.Internal {
|
|||
});
|
||||
}
|
||||
|
||||
internal static string GetUniqueName(FileState fileState) {
|
||||
string key = Random(12);
|
||||
string extension = Path.GetExtension(fileState.Name);
|
||||
internal static string GetUniqueName(FileState state) {
|
||||
string key = Guid.NewGuid().ToString();
|
||||
string extension = Path.GetExtension(state.Name);
|
||||
key += extension;
|
||||
fileState.CloudName = key;
|
||||
return key;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,11 @@ namespace LeanCloud.Storage.Internal {
|
|||
}
|
||||
|
||||
internal async Task<FileState> PutFile(FileState state, string uploadUrl, Stream dataStream) {
|
||||
IList<KeyValuePair<string, string>> makeBlockHeaders = new List<KeyValuePair<string, string>>();
|
||||
makeBlockHeaders.Add(new KeyValuePair<string, string>("Content-Type", state.MimeType));
|
||||
IList<KeyValuePair<string, string>> makeBlockHeaders = new List<KeyValuePair<string, string>> {
|
||||
new KeyValuePair<string, string>("Content-Type", state.MimeType),
|
||||
new KeyValuePair<string, string>("Cache-Control", "public, max-age=31536000"),
|
||||
new KeyValuePair<string, string>("Content-Length", dataStream.Length.ToString())
|
||||
};
|
||||
|
||||
HttpClient client = new HttpClient();
|
||||
HttpRequestMessage request = new HttpRequestMessage {
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace LeanCloud.Storage.Internal {
|
|||
|
||||
public Task<FileState> Upload(FileState state, Stream dataStream, IDictionary<string, object> fileToken, IProgress<AVUploadProgressEventArgs> progress, CancellationToken cancellationToken) {
|
||||
state.frozenData = dataStream;
|
||||
state.CloudName = GetUniqueName(state);
|
||||
state.CloudName = fileToken["key"] as string;
|
||||
MergeFromJSON(state, fileToken);
|
||||
return UploadNextChunk(state, dataStream, string.Empty, 0, progress).OnSuccess(_ => {
|
||||
return state;
|
||||
|
@ -101,12 +101,6 @@ namespace LeanCloud.Storage.Internal {
|
|||
return chunkBinary;
|
||||
}
|
||||
|
||||
internal string GetUniqueName(FileState state) {
|
||||
string key = Guid.NewGuid().ToString();//file Key in Qiniu.
|
||||
string extension = Path.GetExtension(state.Name);
|
||||
key += extension;
|
||||
return key;
|
||||
}
|
||||
internal Task<Tuple<HttpStatusCode, IDictionary<string, object>>> GetQiniuToken(FileState state, CancellationToken cancellationToken) {
|
||||
string str = state.Name;
|
||||
|
||||
|
|
Loading…
Reference in New Issue