From 8bae451e1c7a79f70da851869bfa93b6992ff06f Mon Sep 17 00:00:00 2001 From: Dennis Roberts Date: Mon, 16 Sep 2013 14:27:48 -0700 Subject: [PATCH 1/2] CORE-4326: added support for the old app ID format --- src/donkey/services/metadata/apps.clj | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/donkey/services/metadata/apps.clj b/src/donkey/services/metadata/apps.clj index f60c5aa..71fda7d 100644 --- a/src/donkey/services/metadata/apps.clj +++ b/src/donkey/services/metadata/apps.clj @@ -5,8 +5,9 @@ [donkey.util.service :as service] [mescal.de :as agave])) -(def ^:private uuid-regex - #"^\p{XDigit}{8}(?:-\p{XDigit}{4}){3}-\p{XDigit}{12}$") +(def ^:private uuid-regexes + [#"^\p{XDigit}{8}(?:-\p{XDigit}{4}){3}-\p{XDigit}{12}$" + #"^[at]\p{XDigit}{32}"]) (defprotocol AppLister "Used to list apps available to the Discovery Environment." @@ -33,7 +34,7 @@ (.listPublicApps agave-client) (metadactyl/apps-in-group group-id))) (getApp [this app-id] - (if (re-find uuid-regex app-id) + (if (some #(re-find % app-id) uuid-regexes) (metadactyl/get-app app-id) (.getApp agave-client app-id)))) From 7e6b43f846ef6ae2af14b9b0616b94740a17729d Mon Sep 17 00:00:00 2001 From: John Wregglesworth Date: Mon, 16 Sep 2013 14:29:52 -0700 Subject: [PATCH 2/2] CORE-4768: Fixed an issue where a trailing slash was causing a "File not found". --- src/donkey/services/fileio/actions.clj | 55 +++++++++++++------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/src/donkey/services/fileio/actions.clj b/src/donkey/services/fileio/actions.clj index b773363..bf7af50 100644 --- a/src/donkey/services/fileio/actions.clj +++ b/src/donkey/services/fileio/actions.clj @@ -77,33 +77,34 @@ (string/join "." (drop-last (string/split (ft/basename tmp-path) #"\.")))) (defn upload - [user tmp-path final-path] - (log/info "In upload for " user tmp-path final-path) - (with-jargon (jargon-cfg) [cm] - (when-not (user-exists? cm user) - (throw+ {:error_code ERR_NOT_A_USER - :user user})) - - (when-not (exists? cm final-path) - (throw+ {:error_code ERR_DOES_NOT_EXIST - :id final-path})) - - (when-not (is-writeable? cm user final-path) - (throw+ {:error_code ERR_NOT_WRITEABLE - :id final-path})) - - (let [new-fname (new-filename tmp-path) - new-path (ft/path-join final-path new-fname)] - (if (exists? cm new-path) (delete cm new-path)) - (move cm tmp-path new-path :user user :admin-users (irods-admins) :skip-source-perms? true) - (set-owner cm new-path user) - {:file - {:id new-path - :label (ft/basename new-path) - :permissions (dataobject-perm-map cm user new-path) - :date-created (created-date cm new-path) - :date-modified (lastmod-date cm new-path) - :file-size (str (file-size cm new-path))}}))) + [user tmp-path fpath] + (log/info "In upload for " user tmp-path fpath) + (let [final-path (ft/rm-last-slash fpath)] + (with-jargon (jargon-cfg) [cm] + (when-not (user-exists? cm user) + (throw+ {:error_code ERR_NOT_A_USER + :user user})) + + (when-not (exists? cm final-path) + (throw+ {:error_code ERR_DOES_NOT_EXIST + :id final-path})) + + (when-not (is-writeable? cm user final-path) + (throw+ {:error_code ERR_NOT_WRITEABLE + :id final-path})) + + (let [new-fname (new-filename tmp-path) + new-path (ft/path-join final-path new-fname)] + (if (exists? cm new-path) (delete cm new-path)) + (move cm tmp-path new-path :user user :admin-users (irods-admins) :skip-source-perms? true) + (set-owner cm new-path user) + {:file + {:id new-path + :label (ft/basename new-path) + :permissions (dataobject-perm-map cm user new-path) + :date-created (created-date cm new-path) + :date-modified (lastmod-date cm new-path) + :file-size (str (file-size cm new-path))}})))) (defn url-encoded? [string-to-check]