diff --git a/Notesnook.API/Controllers/S3Controller.cs b/Notesnook.API/Controllers/S3Controller.cs index eaab871..0579803 100644 --- a/Notesnook.API/Controllers/S3Controller.cs +++ b/Notesnook.API/Controllers/S3Controller.cs @@ -81,7 +81,7 @@ namespace Notesnook.API.Controllers return BadRequest(new { error = "Storage limit exceeded." }); } - var url = S3Service.GetUploadObjectUrl(userId, name); + var url = S3Service.GetInternalUploadObjectUrl(userId, name); if (url == null) return BadRequest(new { error = "Could not create signed url." }); var httpClient = new HttpClient(); diff --git a/Notesnook.API/Interfaces/IS3Service.cs b/Notesnook.API/Interfaces/IS3Service.cs index 91cfecd..03cbb91 100644 --- a/Notesnook.API/Interfaces/IS3Service.cs +++ b/Notesnook.API/Interfaces/IS3Service.cs @@ -32,6 +32,7 @@ namespace Notesnook.API.Interfaces Task DeleteDirectoryAsync(string userId); Task GetObjectSizeAsync(string userId, string name); string? GetUploadObjectUrl(string userId, string name); + string? GetInternalUploadObjectUrl(string userId, string name); Task GetDownloadObjectUrl(string userId, string name); Task StartMultipartUploadAsync(string userId, string name, int parts, string? uploadId = null); Task AbortMultipartUploadAsync(string userId, string name, string uploadId); diff --git a/Notesnook.API/Services/S3Service.cs b/Notesnook.API/Services/S3Service.cs index ebe1cd0..89b3877 100644 --- a/Notesnook.API/Services/S3Service.cs +++ b/Notesnook.API/Services/S3Service.cs @@ -160,6 +160,11 @@ namespace Notesnook.API.Services return this.GetPresignedURL(userId, name, HttpVerb.PUT); } + public string? GetInternalUploadObjectUrl(string userId, string name) + { + return this.GetPresignedURL(userId, name, HttpVerb.PUT, S3ClientMode.INTERNAL); + } + public async Task GetDownloadObjectUrl(string userId, string name) { // var subscriptionService = await WampServers.SubscriptionServer.GetServiceAsync(SubscriptionServerTopics.UserSubscriptionServiceTopic);