Giter Club home page Giter Club logo

pbcli's People

Contributors

mydayyy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

privapps tromcho

pbcli's Issues

pbcli not working with PrivateBin using local path in URL

Hello,

while testing I found that pbcli did not work with a PrivateBin instance like https://example.org/localpath/, that means with a local path added to the URL.

I investigated this further and found a workaround for this problem with the following change:

$ git diff
diff --git a/src/api.rs b/src/api.rs
index a48408a..b8d530c 100644
--- a/src/api.rs
+++ b/src/api.rs
@@ -17,7 +17,7 @@ impl API {
     pub fn new(mut url: Url, opts: Opts) -> Self {
         url.set_fragment(None);
         url.set_query(None);
-        url.set_path("");
+//        url.set_path("");
         Self { base: url, opts }
     }

@@ -118,4 +118,4 @@ impl API {
             s => Err(PasteError::UnknownPasteStatus(s)),
         }
     }
-}
\ No newline at end of file
+}
diff --git a/src/main.rs b/src/main.rs
index b5a78f9..a63a7bd 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -110,7 +110,7 @@ fn handle_post(opts: &Opts) -> PbResult<()> {
         std::io::stdout().write_all(serde_json::to_string(&res)?.as_bytes())?;
     } else {
         let mut url = opts.get_url().clone();
-        url.set_path("");
+//        url.set_path("");
         url.set_query(Some(&res.id));
         url.set_fragment(Some(&res.bs58key));
         std::io::stdout().write_all(url.to_string().as_bytes())?;

This works with URLs like https://example.org/localpath/ but fails with https://example.org/localpath (i.e. without the slash at the end). So you probably want to find a more resilient solution.

Feature Request - Sanity Checks Idea

Hi,

Would it be possible to have some sanity checks?

Specifically regarding file size, if a user is suffering from log bloat due to an issue on their system or tries to upload a file over a certain size could the user be prompted by pbcli with a message saying "hey you are about to upload a file of X size, please note this may be rejected by the host and/or take a long time to upload are you sure you want to continue? Y/N"

Perhaps have a default allowed file size and include a file size limit flag that could be set in custom configs should pbcli be packaged by a distro?

Love the tool BTW, really appreciate the work.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.