diff --git a/CHANGELOG.md b/CHANGELOG.md index 486c4cb..bade0ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.7.1 + +- Fix decoding bug introduced in 0.7.0 + - Don't try to base64 decode content if nil + ## 0.7.0 - Fix decoding bug in `get-content!` diff --git a/project.clj b/project.clj index dbbeb02..b5ec9a6 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject dev.nubank/clj-github "0.7.0" +(defproject dev.nubank/clj-github "0.7.1" :description "A Clojure library for interacting with the github developer API" :url "https://github.com/nubank/clj-github" :license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0" diff --git a/src/clj_github/repository.clj b/src/clj_github/repository.clj index b233de8..d0ef525 100644 --- a/src/clj_github/repository.clj +++ b/src/clj_github/repository.clj @@ -60,7 +60,8 @@ ([client org repo path] (get-content! client org repo path {})) ([client org repo path {:keys [ref branch]}] - (base64-lines->string (get-content* client org repo path ref branch)))) + (some-> (get-content* client org repo path ref branch) + base64-lines->string))) (defn get-content-raw! "Returns the bytes contents of a file from the repository default branch (usually `master`). @@ -71,7 +72,8 @@ (^bytes [client org repo path] (get-content-raw! client org repo path {})) (^bytes [client org repo path {:keys [ref branch]}] - (base64-lines->bytes (get-content* client org repo path ref branch)))) + (some-> (get-content* client org repo path ref branch) + base64-lines->bytes))) (defn get-repo! [client org repo] diff --git a/test/clj_github/changeset_test.clj b/test/clj_github/changeset_test.clj index 3af466b..8652dd0 100644 --- a/test/clj_github/changeset_test.clj +++ b/test/clj_github/changeset_test.clj @@ -75,4 +75,13 @@ (sut/create-branch! "master")) (is (nil? (-> (sut/from-branch! client "nubank" "repo" "master") (sut/delete "file") - (sut/get-content "file"))))))) + (sut/get-content "file")))))) + (testing "get missing file" + (with-client [client initial-state] + (-> (sut/orphan client "nubank" "repo") + (sut/put-content "file" "content") + (sut/commit! "initial commit") + (sut/create-branch! "master")) + (let [revision (sut/from-branch! client "nubank" "repo" "master")] + (is (nil? (sut/get-content revision "different_file"))) + (is (nil? (sut/get-content-raw revision "different_file")))))))