mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +13:00
MediaFire encode filename in url, only report upload progress
This commit is contained in:
parent
8818c57e87
commit
6358e1d0bd
1 changed files with 5 additions and 1 deletions
|
@ -25,6 +25,7 @@ You should have received a copy of the GNU General Public License
|
|||
|
||||
// Credits: https://github.com/michalx2
|
||||
|
||||
using HelpersLib;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -57,8 +58,11 @@ public MediaFire(string appId, string apiKey, string user, string pasw, string p
|
|||
|
||||
public override UploadResult Upload(Stream stream, string fileName)
|
||||
{
|
||||
AllowReportProgress = false;
|
||||
GetSessionToken();
|
||||
AllowReportProgress = true;
|
||||
string key = SimpleUpload(stream, fileName);
|
||||
AllowReportProgress = false;
|
||||
string url = null;
|
||||
while ((url = PollUpload(key, fileName)) == null) Thread.Sleep(_pollInterval);
|
||||
return new UploadResult() { IsSuccess = true, URL = url };
|
||||
|
@ -118,7 +122,7 @@ private string PollUpload(string uploadKey, string fileName)
|
|||
if (resp.doupload.status == 99)
|
||||
{
|
||||
if (resp.doupload.quickkey == null) throw new IOException("Invalid response");
|
||||
return string.Format("http://www.mediafire.com/view/{0}/{1}", resp.doupload.quickkey, resp.doupload.filename);
|
||||
return string.Format("http://www.mediafire.com/view/{0}/{1}", resp.doupload.quickkey, URLHelpers.URLEncode(resp.doupload.filename));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue