Coder Social home page Coder Social logo

dutchcoders / transfer.sh Goto Github PK

View Code? Open in Web Editor NEW
14.9K 211.0 1.5K 34.26 MB

Easy and fast file sharing from the command-line.

Home Page: https://github.com/dutchcoders/transfer.sh

License: MIT License

Shell 6.58% Go 83.30% Dockerfile 1.01% Nix 9.04% Makefile 0.07%
golang transfer docker share transfersh hacktoberfest hacktoberfest2021

transfer.sh's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

transfer.sh's Issues

[Question] Files with same token can't be easily zipped together?

Hi transfer.sh devs! I love the service you've provided, but I have one little question.

I notice that when I upload files over curl in batches, they'll have the same token. EG:

https://transfer.sh/IMTKN/file.name
https://transfer.sh/IMTKN/file2.name

But when I upload via the website, I get this:

https://transfer.sh/IMTKN/file.name
https://transfer.sh/IMTKN2/file2.name

I know how to write the url to bundle files under a single zip or .tar.gz, but is there a reason why files underneath the same token can't simply be referred to as https://transfer.sh/IMTKN.zip for a shorter URL? Just curious.

transfer.sh Down?

Hi there! Thanks for making and hosting such a useful service!

It looks like there's some issue with the backend right now?

$ curl -v https://transfer.sh/
*   Trying 54.77.221.1...
* Connected to transfer.sh (54.77.221.1) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate: transfer.sh
* Server certificate: COMODO RSA Domain Validation Secure Server CA
* Server certificate: COMODO RSA Certification Authority
* Server certificate: AddTrust External CA Root
> GET / HTTP/1.1
> Host: transfer.sh
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 503 Service Unavailable: Back-end server is at capacity
< Content-Length: 0
< Connection: keep-alive
<
* Connection #0 to host transfer.sh left intact

Run transfer.sh under Nginx

Hello, I want to run transfer.sh under Nginx but when I put transfer.sh under nginx, it redirect loop from https:// and http://. Anyone try run transfer.sh under nginx ?

Docker run command errors: Error while creating storage

Here are the steps I took:

cd ./transfer.sh/
docker build -t transfersh .
docker run --publish 8080:8080 --rm transfersh --provider local --basedir /tmp/

And the error:

2014/12/08 01:34:19 Error while creating storage.
panic: Error while creating storage.

goroutine 16 [running]:
runtime.panic(0x739160, 0xc2080354e0)
        /usr/src/go/src/pkg/runtime/panic.c:279 +0xf5
log.Panic(0xc2080fde80, 0x1, 0x1)
        /usr/src/go/src/pkg/log/log.go:307 +0xb6
main.main()
        /go/src/app/main.go:162 +0x1c72

goroutine 19 [finalizer wait]:
runtime.park(0x423130, 0xacad10, 0xac8709)
        /usr/src/go/src/pkg/runtime/proc.c:1369 +0x89
runtime.parkunlock(0xacad10, 0xac8709)
        /usr/src/go/src/pkg/runtime/proc.c:1385 +0x3b
runfinq()
        /usr/src/go/src/pkg/runtime/mgc0.c:2644 +0xcf
runtime.goexit()
        /usr/src/go/src/pkg/runtime/proc.c:1445

Ubuntu 14.10, Docker version 1.3.2, build 39fa2fa

Support getting upload slot before upload

Would be nice if there were some way to request the eventual fetch URL first, then upload to it, then fetch from it thereafter. This would simplify some scripting cases.

encryption example does not work when using the `transfer` command

The encryption example does not work when using the transfer command:

cat crm.py | gpg -ac -o- | transfer:

No arguments specified. Usage:
echo transfer /tmp/test.md
cat /tmp/test.md | transfer test.md
gpg: [stdout]: write error: Broken pipe
gpg: iobuf_flush failed on close: file write error```

Support for mkv video files

Hi there,

Many thanks for transfer.sh! I regularly use it to share some files.

Just now I wanted to share a screencast that I had created with simplescreenrecorder on my Linux machine: https://transfer.sh/RzaoH/screencast.mkv

The default format is mkv which currently does not seem to be supported.

Would it be possible to support mkv files?

Thankfully,

Robert

syntax error in bashrc script

Both the transfer.sh script at gist and the two line .bashrc version in 'sample use cases' return ...

syntax error near unexpected token `('

... when running in bash via Manjaro Linux.

In the case of calling the script from my bashrc I get ...

[kevjo@manjaro ~]$ transfer test-transfer.txt

bash: /home/kevjo/Software/Scripts/transfer.sh: line 14: syntax error near unexpected token `('

bash: /home/kevjo/Software/Scripts/transfer.sh: line 14: `transfer() { '

... Inserting the two line snippet version directly in .bashrc results in similar, but with an error line number relevant to location in the bashrc file itself.

Might something be missing from within or preceding the round brackets at "transfer()" perhaps?

Multiple Files?

Hello,

im trying to upload multiple files within a folder to transfer.sh

Any idea how to do so?

transfer * > /home/kvm1/www/uploads.txt

Change color of video player

http://i.imgur.com/Gqx7rfv.png
As you may have noticed buttons under the video are hard to see when you are looking at the player for the first time. I actually had a few situations where I was sending .mp4 and people receiving the link thought that they actually have to download the video instead of just playing it.
Solution is pretty simple, just make buttons brighter than the background, because right now it's really hard to tell if it's just some thumbnail or the actual player.

File names are converted to lower case

curl -v -T Gemfile.lock transfer.sh results in https://transfer.sh/:key/gemfile.lock even thou curl properly sends the PUT request with correct casing.

From the log output:

> PUT /Gemfile.lock HTTP/1.1

This gets pretty annoying when downloading the file again.

Awesome service anyway. Thanks!

Alias for fish-shell

I would like to add this function for fish-shell somewhere in the documentation, but I'm unsure as to where.

function transfer --description 'Upload a file to transfer.sh'
    if [ $argv[1] ]
        # write to output to tmpfile because of progress bar
        set -l tmpfile ( mktemp -t transferXXX )
        curl --progress-bar --upload-file $argv[1] https://transfer.sh/(basename $argv[1]) >> $tmpfile
        cat $tmpfile
        command rm -f $tmpfile
    else
        echo 'usage: transfer FILE_TO_TRANSFER'
    end
end

Doesn't work on MacOS X 10.6

Process: launchd [11727]
Path: /Users/melody/Downloads/transfer.sh.app/Contents/MacOS/applet
Identifier: com.apple.ScriptEditor.id.transfer-sh
Version: ??? (???)
Code Type: X86-64 (Native)
Parent Process: launchd [124]

Date/Time: 2015-03-30 01:01:51.863 +1100
OS Version: Mac OS X 10.6.8 (10K549)
Report Version: 6

Interval Since Last Report: 69981219 sec
Crashes Since Last Report: 836
Per-App Crashes Since Last Report: 4
Anonymous UUID: FC5CA901-E8AF-4044-8E64-7AFB441F5ECA

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0xfffffffffffffff8
Crashed Thread: Unknown

Backtrace not available

Unknown thread crashed with X86 Thread State (64-bit):
rax: 0x0000000000000055 rbx: 0x0000000000000000 rcx: 0x0000000000000000 rdx: 0x0000000000000000
rdi: 0x0000000000000000 rsi: 0x0000000000000000 rbp: 0x0000000000000000 rsp: 0x0000000000000000
r8: 0x0000000000000000 r9: 0x0000000000000000 r10: 0x0000000000000000 r11: 0x0000000000000000
r12: 0x0000000000000000 r13: 0x0000000000000000 r14: 0x0000000000000000 r15: 0x0000000000000000
rip: 0x00007fff5fc01028 rfl: 0x0000000000010203 cr2: 0xfffffffffffffff8

Binary images description not available

Model: iMac8,1, BootROM IM81.00C1.B00, 2 processors, Intel Core 2 Duo, 2.4 GHz, 4 GB, SMC 1.29f1
Graphics: ATI Radeon HD 2400 XT, ATI Radeon HD 2400, PCIe, 128 MB
Memory Module: global_name
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x8C), Broadcom BCM43xx 1.0 (5.10.131.42.4)
Bluetooth: Version 2.4.5f3, 2 service, 19 devices, 1 incoming serial ports
Network Service: Ethernet, Ethernet, en0
Network Service: Ethernet Adaptor (en3), Ethernet, en3
Serial ATA Device: Hitachi HDP725025GLA380, 232.89 GB
Parallel ATA Device: MATSHITADVD-R UJ-875
USB Device: Built-in iSight, 0x05ac (Apple Inc.), 0x8502, 0xfd400000 / 3
USB Device: USB 2.0 Hub [MTT], 0x1a40 (TERMINUS TECHNOLOGY INC.), 0x0201, 0xfd100000 / 2
USB Device: nanoKONTROL2, 0x0944 (KORG, Inc.), 0x0117, 0xfd120000 / 7
USB Device: USB to Serial-ATA bridge, 0x059b (Iomega Corporation), 0x0577, 0xfd170000 / 6
USB Device: iMic USB audio system, 0x077d, 0x07af, 0xfd140000 / 5
USB Device: QX61, 0x13b2, 0x0077, 0xfd150000 / 4
USB Device: IR Receiver, 0x05ac (Apple Inc.), 0x8242, 0x5d100000 / 2
USB Device: BRCM2046 Hub, 0x0a5c (Broadcom Corp.), 0x4500, 0x1a100000 / 2
USB Device: Bluetooth USB Host Controller, 0x05ac (Apple Inc.), 0x820f, 0x1a110000 / 4
USB Device: 2.4G Keyboard Mouse, 0x062a (ProVision Technology, Inc.), 0x4101, 0x3a200000 / 2

Running in Docker daemon mode

Most likely I'm misunderstanding something but how do I get this running in daemon mode in Docker? I tried the following but I could not curl a file to port 8085.

docker run -d -p 8085:8080 --name transfersh transfersh

Gave this error:

curl --upload-file ./test123.txt http://192.168.1.89:8085/
curl: (7) Failed to connect to 192.168.1.89 port 8085: Connection refused

OK: was passing the Go params in the wrong place. This works without giving the connection refuse error but the files are not uploaded. i.e.: /tmp/ is empty after the curl command.

docker run -d -p 8085:8080 --name transfersh transfersh --basedir /tmp/ --provider local

Logs show this only. Is there a way to up the level to debug?:

10/14/2016 12:56:37 PMNumber of CPUs:  2
10/14/2016 12:56:37 PMProfiled listening at: :6060
10/14/2016 12:56:37 PM2016/10/14 16:56:37 Transfer.sh server started. :
10/14/2016 12:56:37 PMlistening on port: 8080
10/14/2016 12:56:37 PMusing temp folder: /tmp
10/14/2016 12:56:37 PMusing storage provider: local
10/14/2016 12:56:37 PM2016/10/14 16:56:37 ---------------------------

Transfer.sh alias mangles output for hidden onion service

https://gist.github.com/BoBeR182/27ef189e6a61ca5add5c123c558a29d4
Is what I am using for my alias

When doing the following command.

transfer files.zip

I get an incorrect URL with an invalid SSL cert. See log below...

[bober@boberbot][~]% transfer files.zip

################################################################## 100.0%

https://jxm5d6emw5rknovg.onion/9EZaY/files.zip

If a file is uploaded via the onion hidden service the output from the server should be without SSL.

upload a file to local host returns 301

I am installing the app using docker on my laptop. I get 301 when trying to upload a file.
curl -v --upload-file ./hello.txt http://localhost:8080/hello.txt

* Hostname was NOT found in DNS cache
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> PUT /hello.txt HTTP/1.1
> User-Agent: curl/7.37.1
> Host: localhost:8080
> Accept: */*
> Content-Length: 10
> Expect: 100-continue
> 
< HTTP/1.1 301 Moved Permanently
< Location: https://transfer.sh/hello.txt
* Server Transfer.sh HTTP Server 1.0 is not blacklisted
< Server: Transfer.sh HTTP Server 1.0
< X-Made-With: <3 by DutchCoders
< X-Served-By: Proudly served by DutchCoders
< Date: Mon, 08 Dec 2014 21:33:32 GMT
< Content-Length: 0
< Content-Type: text/plain; charset=utf-8
* HTTP error before end of send, stop sending

Return http scheme according to upload scheme (non-https support when printing share url)

https may not be always available or hard to configure if using docker containers etc.
It would be great if URL could be returned with the same http scheme that it was uploaded, now it always return https url even if upload was using http
Looks like https scheme is hardcoded:

fmt.Fprintf(w, "https://%s/%s/%s\n", ipAddrFromRemoteAddr(r.Host), token, filename)

Thanks

support Range request from HTTP Header

Hi,

If you want to support Range requests, the easy way is you need something like

http.ServeContent(w, r, filename, modTime, seeker)

in your getHandler instead of the io.Copy.

This will allow seeking for media files.

curl: no URL specified!

So i just went to your website copied this:

# Add this to .bashrc or its equivalent 
transfer() { if [ $# -eq 0 ]; then echo "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"; return 1; fi 
tmpfile=$( mktemp -t transferXXX ); if tty -s; then basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; else curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ; fi; cat $tmpfile; rm -f $tmpfile; } 

I have save it in my .zshrc and when i run transfer test.txt i get this error:

Any idea why and how to fix it?

Install on a raspberry pi?

I can't seem to get docker to host it's own transfer.sh site. `pi@raspberrypi:/opt $ cd transfer.sh
pi@raspberrypi:/opt/transfer.sh $ docker build -t transfersh .

Sending build context to Docker daemon 2.358 MB
Step 1 : FROM golang
latest: Pulling from library/golang
efd26ecc9548: Pull complete
a3ed95caeb02: Pull complete
d1784d73276e: Pull complete
72e581645fc3: Pull complete
01ce90e06b06: Pull complete
666886c80650: Pull complete
2b9aef313bfc: Pull complete
a47658d1602e: Pull complete
Digest: sha256:d93f678ece9be3e1b5c8d845892fd5d469c8cb8aef335cee8df63c41d0f60818
Status: Downloaded newer image for golang:latest
---> a274681c9df8
Step 2 : MAINTAINER Remco Verhoef [email protected]
---> Running in 819bc2ab9d32
---> 1bc96b6d1c8c
Removing intermediate container 819bc2ab9d32
Step 3 : RUN mkdir -p /go/src/app
---> Running in 772ee128ed22
exec format error
Cannot start container 772ee128ed223d3e66ae4a779dec07375e5d06d33f81404029976973e6712504: [9] System error: exec format error
pi@raspberrypi:/opt/transfer.sh $ docker run --publish 8080:8080 --rm transfersh --provider local --basedir /tmp/
Unable to find image 'transfersh:latest' locally
Pulling repository docker.io/library/transfersh
docker: Error: image library/transfersh not found.
See 'docker run --help'.
pi@raspberrypi:/opt/transfer.sh`

Any ways I can host it on my raspberry pi? if so any help is appreciated :)

Add rate limiting

It needs rate limiting for uploading files. Maybe 15 per minute per IP?

API for other platforms!

Is there any web API available for transfer.sh? I'd like to develop mobile app for this service. If people are interested, I can start working on UI mockups and UX proposal right away.

Possible to generate our own random token?

I have one PC that needs to share a file that changes daily with another PC remotely (not on same network).

I looked at the example provided on the website:
(Uploading is easy using curl)
$ curl --upload-file ./hello.txt https://transfer.sh/hello.txt
https://transfer.sh/66nb8/hello.txt
(Download the file)
$ curl https://transfer.sh/66nb8/hello.txt -o hello.txt

After the upload, the curl command returns a URL with a random token ("66nb8" in the above example). The problem is the other PC doesn't know the random token, and also I want to put the download command in cron. Is it possible for us to specify our own random token that we could use over and over? The file is encrypted so security concern with plaintext URL is not a problem.

curl --upload-file ./hello.txt https://transfer.sh/3b2rd9n3kbew8jhs/hello.txt

...where 3b2rd9n3kbew8jhs is the random token chosen by the user.

Thank you.

Add support for directories in the alias

Hi guys,

I think it would be nice to add directory support in the given alias. We could first create a tarball of it and then upload it. Something like this:

transfer() {
  file=$1

  if [[ -d $1 ]]; then
    file=$(basename $1).tar.gz
    tar cvzf $file $1
  fi

  # write to output to tmpfile because of progress bar
  tmpfile=$( mktemp -t transferXXX )
  curl --progress-bar --upload-file $file https://transfer.sh/$(basename $file) >> $tmpfile
  cat $tmpfile;
  rm -f $tmpfile;
}

What do you think?

Add raw link to the file

transfer.sh seems to do some kind of user agent sniffing and it displays the files in a HTML wrapper in the browser. Which is fine, but it should also display a raw link to the file which does not ever add the wrapper because now it is impossible to view images in their full size or use JSON-formatting extensions to view json files in browser.

Opening uploaded html file link to browser causes browser to execute the javascript in the file

When you upload an html file and open the given url in the browser (tested on Chrome) the javascript that was in the file executes. For example, below I have an html file that redirects the user to another website, so when I open the link to the file on transfer.sh it ends up executing the redirect code instead of just showing me a preview.

Sample code:

<!DOCTYPE HTML>
<html lang="en-US">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="refresh" content="1;url=http://www.sample.com">
        <script type="text/javascript">
            window.location.href = "http://www.sample.com"
        </script>
        <title>Page Redirection</title>
    </head>
    <body>
        <!-- Note: don't tell people to `click` the link, just tell them that it is a link. -->
        If you are not redirected automatically, follow the <a href='http://www.sample.com'>link to sample</a>
    </body>
</html>

Please allow for uppercase download URLs

Right now it seems that the download URLs returneed from transfer.sh are always lowercase. Please allow for uppercase characters in download URLs as well.

If that is already possible, please show me how.

DELETE a file ?

curl -X DELETE https://transfer.sh/xf54d/myfile.password
would be awesome.

Not uploading files when filename has Spaces

I'm getting upload errors when trying to upload a file with spaces, even when correctly escaping the spaces with a backslash.

Example: transfer Getting\ Started\ With\ Git.pdf

Errors when trying the above command:

curl: Can't open 'Getting'!
curl: try 'curl --help' or 'curl --manual' for more information

curl: (6) Could not resolve host: With

curl: (6) Could not resolve host: Git.png
######################################################################## 100.0%

curl: (6) Could not resolve host: Started

curl: (6) Could not resolve host: With

curl: (6) Could not resolve host: Git.png
Not Found

how to build this, its not working ubuntu 15.04 server

not working . go build -o transfersh-server/*.go

go version
go version go1.3.3 linux/amd64

/go/transfer.sh-master# go build -o transfersh-server/_.go
transfersh-server/main.go:43:2: cannot find package "github.com/PuerkitoBio/ghost/handlers" in any of:
/usr/lib/go/src/pkg/github.com/PuerkitoBio/ghost/handlers (from $GOROOT)
/root/go/src/github.com/PuerkitoBio/ghost/handlers (from $GOPATH)
transfersh-server/handlers.go:52:2: cannot find package "github.com/dutchcoders/go-clamd" in any of:
/usr/lib/go/src/pkg/github.com/dutchcoders/go-clamd (from $GOROOT)
/root/go/src/github.com/dutchcoders/go-clamd (from $GOPATH)
transfersh-server/virustotal.go:30:2: cannot find package "github.com/dutchcoders/go-virustotal" in any of:
/usr/lib/go/src/pkg/github.com/dutchcoders/go-virustotal (from $GOROOT)
/root/go/src/github.com/dutchcoders/go-virustotal (from $GOPATH)
transfersh-server/utils.go:35:2: cannot find package "github.com/goamz/goamz/aws" in any of:
/usr/lib/go/src/pkg/github.com/goamz/goamz/aws (from $GOROOT)
/root/go/src/github.com/goamz/goamz/aws (from $GOPATH)
transfersh-server/storage.go:14:2: cannot find package "github.com/goamz/goamz/s3" in any of:
/usr/lib/go/src/pkg/github.com/goamz/goamz/s3 (from $GOROOT)
/root/go/src/github.com/goamz/goamz/s3 (from $GOPATH)
transfersh-server/utils.go:37:2: cannot find package "github.com/golang/gddo/httputil/header" in any of:
/usr/lib/go/src/pkg/github.com/golang/gddo/httputil/header (from $GOROOT)
/root/go/src/github.com/golang/gddo/httputil/header (from $GOPATH)
transfersh-server/handlers.go:54:2: cannot find package "github.com/gorilla/mux" in any of:
/usr/lib/go/src/pkg/github.com/gorilla/mux (from $GOROOT)
/root/go/src/github.com/gorilla/mux (from $GOPATH)
transfersh-server/handlers.go:55:2: cannot find package "github.com/kennygrant/sanitize" in any of:
/usr/lib/go/src/pkg/github.com/kennygrant/sanitize (from $GOROOT)
/root/go/src/github.com/kennygrant/sanitize (from $GOPATH)
transfersh-server/handlers.go:56:2: cannot find package "github.com/russross/blackfriday" in any of:
/usr/lib/go/src/pkg/github.com/russross/blackfriday (from $GOROOT)
/root/go/src/github.com/russross/blackfriday (from $GOPATH)
root@vp34534534:
/go/transfer.sh-master# go run transfersh-server/_.go -provider=local --port 8080 --temp=/tmp/ --basedir=/tmp/
transfersh-server/main.go:43:2: cannot find package "github.com/PuerkitoBio/ghost/handlers" in any of:
/usr/lib/go/src/pkg/github.com/PuerkitoBio/ghost/handlers (from $GOROOT)
/root/go/src/github.com/PuerkitoBio/ghost/handlers (from $GOPATH)
transfersh-server/handlers.go:52:2: cannot find package "github.com/dutchcoders/go-clamd" in any of:
/usr/lib/go/src/pkg/github.com/dutchcoders/go-clamd (from $GOROOT)
/root/go/src/github.com/dutchcoders/go-clamd (from $GOPATH)
transfersh-server/virustotal.go:30:2: cannot find package "github.com/dutchcoders/go-virustotal" in any of:
/usr/lib/go/src/pkg/github.com/dutchcoders/go-virustotal (from $GOROOT)
/root/go/src/github.com/dutchcoders/go-virustotal (from $GOPATH)
transfersh-server/utils.go:35:2: cannot find package "github.com/goamz/goamz/aws" in any of:
/usr/lib/go/src/pkg/github.com/goamz/goamz/aws (from $GOROOT)
/root/go/src/github.com/goamz/goamz/aws (from $GOPATH)
transfersh-server/storage.go:14:2: cannot find package "github.com/goamz/goamz/s3" in any of:
/usr/lib/go/src/pkg/github.com/goamz/goamz/s3 (from $GOROOT)
/root/go/src/github.com/goamz/goamz/s3 (from $GOPATH)
transfersh-server/utils.go:37:2: cannot find package "github.com/golang/gddo/httputil/header" in any of:
/usr/lib/go/src/pkg/github.com/golang/gddo/httputil/header (from $GOROOT)
/root/go/src/github.com/golang/gddo/httputil/header (from $GOPATH)
transfersh-server/handlers.go:54:2: cannot find package "github.com/gorilla/mux" in any of:
/usr/lib/go/src/pkg/github.com/gorilla/mux (from $GOROOT)
/root/go/src/github.com/gorilla/mux (from $GOPATH)
transfersh-server/handlers.go:55:2: cannot find package "github.com/kennygrant/sanitize" in any of:
/usr/lib/go/src/pkg/github.com/kennygrant/sanitize (from $GOROOT)
/root/go/src/github.com/kennygrant/sanitize (from $GOPATH)
transfersh-server/handlers.go:56:2: cannot find package "github.com/russross/blackfriday" in any of:
/usr/lib/go/src/pkg/github.com/russross/blackfriday (from $GOROOT)
/root/go/src/github.com/russross/blackfriday (from $GOPATH)

mktemp fails on Peppermint 4 Linux

Steps to recreate.

Running on Peppermint 4 Linux.

$ transfer() {
> # write to output to tmpfile because of progress bar
> tmpfile=$( mktemp -t transfer )
> curl --progress-bar --upload-file $1 https://transfer.sh/$(basename $1) >> $tmpfile
> cat $tmpfile
> rm -f $tmpfile;
> }
$ alias transfer=transfer
$ transfer /var/log/syslog
mktemp: too few X's in template ‘transfer’
-bash: $tmpfile: ambiguous redirect

What's going wrong?

In the version of mktemp on Peppermint 4 Linux, template requires at least 3 consecutive XXX's.

$ mktemp --help
mktemp --help
Usage: mktemp [OPTION]... [TEMPLATE]
Create a temporary file or directory, safely, and print its name.
TEMPLATE must contain at least 3 consecutive 'X's in last component.
If TEMPLATE is not specified, use tmp.XXXXXXXXXX, and --tmpdir is implied.
Files are created u+rw, and directories u+rwx, minus umask restrictions.

  -d, --directory     create a directory, not a file
  -u, --dry-run       do not create anything; merely print a name (unsafe)
  -q, --quiet         suppress diagnostics about file/dir-creation failure
      --suffix=SUFF   append SUFF to TEMPLATE.  SUFF must not contain slash.
                        This option is implied if TEMPLATE does not end in X.
      --tmpdir[=DIR]  interpret TEMPLATE relative to DIR.  If DIR is not
                        specified, use $TMPDIR if set, else /tmp.  With
                        this option, TEMPLATE must not be an absolute name.
                        Unlike with -t, TEMPLATE may contain slashes, but
                        mktemp creates only the final component

  -p DIR              use DIR as a prefix; implies -t [deprecated]
  -t                  interpret TEMPLATE as a single file name component,
                        relative to a directory: $TMPDIR, if set; else the
                        directory specified via -p; else /tmp [deprecated]

      --help     display this help and exit
      --version  output version information and exit

Report mktemp bugs to [email protected]
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
For complete documentation, run: info coreutils 'mktemp invocation'

Workaround

So the following workaround works.

transfer() {
# write to output to tmpfile because of progress bar
tmpfile=$( mktemp -t transferXXX )
curl --progress-bar --upload-file $1 https://transfer.sh/$(basename $1) >> $tmpfile;
cat $tmpfile;
rm -f $tmpfile;
}

alias transfer=transfer

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.