Skip to content

Commit

Permalink
Merge pull request #732 from haiwen/fix_file_update_fail
Browse files Browse the repository at this point in the history
fix upload file failed in root dir
  • Loading branch information
freeplant authored Apr 14, 2018
2 parents ca0ab76 + c1fef43 commit 3a58116
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId 'com.seafile.seadroid2'
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 77
versionName "2.2.2"
versionCode 78
versionName "2.2.3"
multiDexEnabled true
resValue "string", "authorities", applicationId + '.cameraupload.provider'
resValue "string", "account_type", "com.seafile.seadroid2.account.api2"
Expand Down
9 changes: 7 additions & 2 deletions app/src/main/java/com/seafile/seadroid2/SeafConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -828,10 +828,15 @@ private String uploadFileCommon(String link, String repoID, String dir,
MultipartBody.Builder builder = new MultipartBody.Builder();
//set type
builder.setType(MultipartBody.FORM);
// "target_file" "parent_dir" must be "/" end off
if (!TextUtils.equals("/", dir)) {
dir = dir + "/";
}

if (update) {
builder.addFormDataPart("target_file", dir + "/");
builder.addFormDataPart("target_file", dir);
} else {
builder.addFormDataPart("parent_dir", dir + "/");
builder.addFormDataPart("parent_dir", dir);
}

builder.addFormDataPart("file", file.getName(), RequestManager.getInstance().createProgressRequestBody(monitor, file));
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.android.tools.build:gradle:3.1.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sat Oct 28 11:02:56 CST 2017
#Wed Apr 04 14:05:15 CST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

0 comments on commit 3a58116

Please sign in to comment.