Encode URL Path for ACL

This commit is contained in:
Matthew Burnett 2018-04-20 16:47:30 -04:00
parent 7c3569a39d
commit c215797c8a

View file

@ -29,9 +29,9 @@ You should have received a copy of the GNU General Public License
using ShareX.HelpersLib;
using ShareX.UploadersLib.Properties;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Web;
using System.Windows.Forms;
namespace ShareX.UploadersLib.FileUploaders
@ -141,12 +141,11 @@ public override UploadResult Upload(Stream stream, string fileName)
stream, contentType, args, googleAuth.GetAuthHeaders());
string responsename = JsonConvert.DeserializeObject<GoogleCloudStorageResponse>(result.Response).name;
Debug.WriteLine(uploadpath);
if (responsename == uploadpath)
{
string encodeduploadpath = HttpUtility.UrlEncode(uploadpath);
string requestjson = JsonConvert.SerializeObject(publicacl);
SendRequest(HttpMethod.POST, $"https://www.googleapis.com/storage/v1/b/{bucket}/o/{uploadpath}/acl",
SendRequest(HttpMethod.POST, $"https://www.googleapis.com/storage/v1/b/{bucket}/o/{encodeduploadpath}/acl",
requestjson, ContentTypeJSON, headers: googleAuth.GetAuthHeaders());
}