Skip to content

Commit

Permalink
Do not trip on new warn before read feature
Browse files Browse the repository at this point in the history
Upstream privatebin introduced this new feature  PrivateBin/PrivateBin#1237

If the fragment contains a prefix character `-` , then the ui is supposed to warn before actyally getting paste, as the paste may be burn on read.

This character can trip our reading of the bs58key. So, strip the prefix if found.
  • Loading branch information
nain-F49FF806 authored and Mydayyy committed Apr 26, 2024
1 parent 1288834 commit c937a7f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@ fn create_dataurl(path: &std::ffi::OsStr, data: String) -> String {
fn handle_get(opts: &Opts) -> PbResult<()> {
let url = opts.get_url();
let paste_id = opts.get_url().query().unwrap();
let key = opts
let fragment = opts
.get_url()
.fragment()
.ok_or(PasteError::MissingDecryptionKey)?;
// '-' character may be found at start of fragment. This should be stripped.
// It is used to activate "warn before read" feature for burn on read pastes.
let key = fragment.strip_prefix('-').unwrap_or(fragment);

let api = API::new(url.clone(), opts.clone());
let paste = api.get_paste(paste_id)?;
Expand Down

0 comments on commit c937a7f

Please sign in to comment.