Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,4 @@ UpgradeLog*.htm
# Microsoft Fakes
FakesAssemblies/
/SeafClient.v2.ncrunchproject
/.vs
7 changes: 5 additions & 2 deletions SeafClient/Requests/Files/GetUploadLinkRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,18 @@ public class GetUploadLinkRequest : SessionRequest<string>
{
public String LibraryId { get; set; }

public string ParentDir { get; set; }

public override string CommandUri
{
get { return String.Format("api2/repos/{0}/upload-link/", LibraryId); }
get { return $"api2/repos/{LibraryId}/upload-link/?p={ParentDir}"; }
}

public GetUploadLinkRequest(string authToken, string libraryId)
public GetUploadLinkRequest(string authToken, string libraryId, string parentDir = "/")
: base(authToken)
{
LibraryId = libraryId;
ParentDir = parentDir;
}

public override SeafError GetSeafError(System.Net.Http.HttpResponseMessage msg)
Expand Down
2 changes: 1 addition & 1 deletion SeafClient/SeafSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ public async Task<bool> UploadSingle(SeafLibrary library, string targetDirectory
public async Task<bool> UploadSingle(string libraryId, string targetDirectory, string targetFilename, Stream fileContent, Action<float> progressCallback = null)
{
// to upload files we need to get an upload link first
var req = new GetUploadLinkRequest(AuthToken, libraryId);
var req = new GetUploadLinkRequest(AuthToken, libraryId, targetDirectory);
var uploadLink = await _webConnection.SendRequestAsync(ServerUri, req);

var uploadRequest = new UploadFilesRequest(AuthToken, uploadLink, targetDirectory, targetFilename, fileContent, progressCallback);
Expand Down