Skip to content

Commit

Permalink
Make sure remote directory isn't empty when using it
Browse files Browse the repository at this point in the history
  • Loading branch information
nikkiii committed Jan 23, 2014
1 parent 2293caf commit 3127cd7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/org/sleeksnap/uploaders/generic/FTPUploader.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public String ftpUpload(String fileName, InputStream input)
throw new UploaderConfigurationException("Unable to connect to FTP server, please check your username and password.");
}

if (settings.has("remotedir")) {
if (settings.has("remotedir") && !settings.isEmpty("remotedir")) {
if(!ftp.cwd(settings.getString("remotedir"))) {
throw new UploaderConfigurationException("Unable to change FTP directory.");
}
Expand Down
4 changes: 4 additions & 0 deletions src/org/sleeksnap/uploaders/settings/UploaderSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,4 +172,8 @@ public JSONObject getJSONObject(String string) {
public String toString() {
return settings.toString();
}

public boolean isEmpty(String string) {
return settings.getString(string, "").equals("");
}
}

0 comments on commit 3127cd7

Please sign in to comment.