Skip to content
Merged
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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!`
Expand Down
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
6 changes: 4 additions & 2 deletions src/clj_github/repository.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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`).
Expand All @@ -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]
Expand Down
11 changes: 10 additions & 1 deletion test/clj_github/changeset_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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")))))))
Loading