Skip to content

Commit a6945c2

Browse files
authored
Merge pull request #77 from vohoanglong0107/fix-decode-file-content-with-octocrab
fix: decode file content with octocrab builtin
2 parents defd639 + ebedb35 commit a6945c2

File tree

3 files changed

+1
-7
lines changed

3 files changed

+1
-7
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ sha2 = "0.10"
5151
hmac = "0.12"
5252
hex = "0.4"
5353
secrecy = "0.8"
54-
base64 = "0.22.0"
5554

5655
# Database
5756
sqlx = { version = "0.7.4", features = ["runtime-tokio-rustls", "sqlite", "postgres"] }

src/github/api/client.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use anyhow::Context;
22
use axum::async_trait;
3-
use base64::Engine;
43
use octocrab::models::{App, Repository, RunId};
54
use octocrab::{Error, Octocrab};
65
use tracing::log;
@@ -66,15 +65,12 @@ impl RepositoryClient for GithubRepositoryClient {
6665
)
6766
})?;
6867

69-
let engine = base64::engine::general_purpose::STANDARD;
7068
response
7169
.take_items()
7270
.into_iter()
7371
.next()
74-
.and_then(|content| content.content)
72+
.and_then(|content| content.decoded_content())
7573
.ok_or_else(|| anyhow::anyhow!("Configuration file not found"))
76-
.and_then(|content| Ok(engine.decode(content.trim())?))
77-
.and_then(|content| Ok(String::from_utf8(content)?))
7874
.and_then(|content| {
7975
let config: RepositoryConfig = toml::from_str(&content).map_err(|error| {
8076
anyhow::anyhow!("Could not deserialize repository config: {error:?}")

0 commit comments

Comments
 (0)