zlin / wgetpaste

MIT License
34 stars 18 forks source link

new dpaste API seems to mangle whitespace #22

Closed benkohler closed 3 years ago

benkohler commented 3 years ago

The new dpaste API seems to be mangling spaces, for example: https://dpaste.com/G9USGHUC9.txt

I ran wgetpaste on an ebuild as an example and the result is:

+Copyright+1999-2021+Gentoo+Authors

+Distributed+under+the+terms+of+the+GNU+General+Public+License+v2

EAPI="7"

DESCRIPTION="Command-line+interface+to+various+pastebins" HOMEPAGE="http://wgetpaste.zlin.dk/"

COMMIT_HASH="f9b08c50009485817e8b44300f79a92e37fe9f22" SRC_URI="https://github.com/zlin/wgetpaste/archive/${COMMIT_HASH}.tar.gz+->+${P}.tar.gz"

LICENSE="public-domain" SLOT="0" KEYWORDS="~alpha+~amd64+~arm+~arm64+~hppa+~ia64+~mips+~ppc+~ppc64+~riscv+~s390+~sparc+~x86+~amd64-linux+~x86-linux+~x64-macos" IUSE="%2bssl"

RDEPEND="net-misc/wget[ssl?]"

S="${WORKDIR}/${PN}-${COMMIT_HASH}"

src_prepare()+{ sed+-i+-e+"s:/etc:\"${EPREFIX}\"/etc:g"+wgetpaste+||+die default }

src_install()+{ dobin+${PN} insinto+/usr/share/zsh/site-functions doins+_wgetpaste }

benkohler commented 3 years ago

Or for a more generic example, "mount | wgetpaste":

/dev/sda2+on+/+type+btrfs+(rw,relatime,ssd,space_cache,subvolid=5,subvol=/) devtmpfs+on+/dev+type+devtmpfs+(rw,relatime,size=4011820k,nr_inodes=1002955,mode=755) proc+on+/proc+type+proc+(rw,nosuid,nodev,noexec,relatime) sysfs+on+/sys+type+sysfs+(rw,nosuid,nodev,noexec,relatime) tmpfs+on+/dev/shm+type+tmpfs+(rw,nosuid,nodev) devpts+on+/dev/pts+type+devpts+(rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000) tmpfs+on+/run+type+tmpfs+(rw,nosuid,nodev,size=1605540k,nr_inodes=819200,mode=755) cgroup2+on+/sys/fs/cgroup+type+cgroup2+(rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot) efivarfs+on+/sys/firmware/efi/efivars+type+efivarfs+(rw,nosuid,nodev,noexec,relatime) none+on+/sys/fs/bpf+type+bpf+(rw,nosuid,nodev,noexec,relatime,mode=700) systemd-1+on+/proc/sys/fs/binfmt_misc+type+autofs+(rw,relatime,fd=30,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=4716) hugetlbfs+on+/dev/hugepages+type+hugetlbfs+(rw,relatime,pagesize=2M) mqueue+on+/dev/mqueue+type+mqueue+(rw,nosuid,nodev,noexec,relatime) debugfs+on+/sys/kernel/debug+type+debugfs+(rw,nosuid,nodev,noexec,relatime) tracefs+on+/sys/kernel/tracing+type+tracefs+(rw,nosuid,nodev,noexec,relatime) tmpfs+on+/tmp+type+tmpfs+(rw,nosuid,nodev,nr_inodes=409600) /dev/sda1+on+/boot+type+vfat+(rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro) tmpfs+on+/run/user/1000+type+tmpfs+(rw,nosuid,nodev,relatime,size=802768k,nr_inodes=200692,mode=700,uid=1000,gid=100)

benkohler commented 3 years ago

Seems to be a problem with the default escapes, this helps:

--- a/wgetpaste +++ b/wgetpaste @@ -110,6 +110,8 @@ Python Python%Interactive/Traceback Ruby Ruby%HTML%(ERB) SQL XML" LANGUAGE_VALUES_dpaste="% Apache Bash Css Diff DjangoTemplate Haskell JScript Python PythonConsole \ Ruby Rhtml Sql Xml" EXPIRATIONS_dpaste=$(printf "%s " {1..365}) +escape_description_dpaste() { echo "$"; } +escape_input_dpaste() { echo "$"; } POST_dpaste() { local title="${2}" local syntax="${3}"

Cogitri commented 3 years ago

Mind opening a PR for this?

benkohler commented 3 years ago

Thanks guys