Compare commits

...

3 Commits

Author SHA1 Message Date
dependabot[bot] f6d8e906fb chore(deps): bump bumpalo from 3.11.0 to 3.12.0
Bumps [bumpalo](https://github.com/fitzgen/bumpalo) from 3.11.0 to 3.12.0.
- [Release notes](https://github.com/fitzgen/bumpalo/releases)
- [Changelog](https://github.com/fitzgen/bumpalo/blob/main/CHANGELOG.md)
- [Commits](https://github.com/fitzgen/bumpalo/compare/3.11.0...3.12.0)

---
updated-dependencies:
- dependency-name: bumpalo
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-03 20:31:43 +02:00
dependabot[bot] 47b6225280 chore(deps): bump openssl from 0.10.42 to 0.10.48
Bumps [openssl](https://github.com/sfackler/rust-openssl) from 0.10.42 to 0.10.48.
- [Release notes](https://github.com/sfackler/rust-openssl/releases)
- [Commits](https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.42...openssl-v0.10.48)

---
updated-dependencies:
- dependency-name: openssl
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-03 20:31:05 +02:00
Andre Julius e9a7108f90 Fix deprecation warning of base64 crate.
See: https://github.com/M3DZIK/imgurs/actions/runs/3871046426/jobs/6598478600
2023-04-03 20:29:17 +02:00
2 changed files with 9 additions and 7 deletions

12
Cargo.lock generated
View File

@ -198,9 +198,9 @@ dependencies = [
[[package]]
name = "bumpalo"
version = "3.11.0"
version = "3.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d"
checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535"
[[package]]
name = "bytemuck"
@ -1262,9 +1262,9 @@ checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1"
[[package]]
name = "openssl"
version = "0.10.42"
version = "0.10.48"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12fc0523e3bd51a692c8850d075d74dc062ccf251c0110668cbd921917118a13"
checksum = "518915b97df115dd36109bfa429a48b8f737bd05508cf9588977b599648926d2"
dependencies = [
"bitflags",
"cfg-if",
@ -1294,9 +1294,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]]
name = "openssl-sys"
version = "0.9.76"
version = "0.9.83"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5230151e44c0f05157effb743e8d517472843121cf9243e8b81393edb5acd9ce"
checksum = "666416d899cf077260dac8698d60a60b435a46d57e82acb1be3d0dad87284e5b"
dependencies = [
"autocfg",
"cc",

View File

@ -59,12 +59,14 @@ impl ImgurClient {
/// }
/// ```
pub async fn upload_image(&self, path: &str) -> Result<ImageInfo> {
use base64::prelude::{Engine, BASE64_STANDARD};
let mut image = path.to_string();
// check if the specified file exists if not then check if it is a url
if std::path::Path::new(path).exists() {
let bytes = std::fs::read(path)?;
image = base64::encode(bytes)
image = BASE64_STANDARD.encode(bytes)
}
// validate url adress
else if !validator::validate_url(path) {