diff --git a/upload/src/main.rs b/upload/src/main.rs index 975f010..91a9068 100644 --- a/upload/src/main.rs +++ b/upload/src/main.rs @@ -2,12 +2,11 @@ use clap::{ArgAction, Parser}; use jacquard::api::com_atproto::repo::apply_writes::{ self, ApplyWrites, ApplyWritesOutput, ApplyWritesWritesItem, }; +use jacquard::client::AgentSessionExt; use jacquard::client::MemorySessionStore; -use jacquard::client::{AgentSessionExt}; use jacquard::oauth::loopback::LoopbackConfig; use jacquard::oauth::types::AuthorizeOptions; use jacquard::types::string::{AtStrError, RecordKey, Rkey}; -use jacquard::{atproto, oauth}; use jacquard::{ Data, api::com_atproto::{self, repo::list_records::ListRecords}, @@ -17,7 +16,8 @@ use jacquard::{ types::{ident::AtIdentifier, nsid::Nsid, string::AtprotoStr, uri::Uri}, xrpc::XrpcExt, }; -use miette::{IntoDiagnostic, Result}; +use jacquard::{atproto, oauth}; +use miette::{Context, IntoDiagnostic, Result}; use std::{collections::HashMap, fs, path::PathBuf}; use crate::sitemap::{BlobRef, Sitemap, SitemapNode}; @@ -173,7 +173,9 @@ async fn update_remote_site( let mut create_records = new_sitemap .into_iter() .map(|(k, v)| { - let rkey = RecordKey(Rkey::new_owned(k).into_diagnostic()?); + let rkey = + utils::url_to_rkey(k).wrap_err("Invalid file path. Could not be converted to rkey")?; + let rkey = RecordKey(Rkey::new_owned(rkey).into_diagnostic()?); let blob = match v.blob { BlobRef::Local(_) => panic!("Illegal local blob"), BlobRef::Remote(cid) => cid,