Skip to content

Commit 6d365a5

Browse files
author
Charles-Antoine Mathieu
committed
Merge pull request src-d#147 from root-gg/1.1.1
Version 1.1.1
2 parents 3094de5 + eeedde6 commit 6d365a5

File tree

5 files changed

+23
-14
lines changed

5 files changed

+23
-14
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
# THE SOFTWARE.
2525
###
2626

27-
RELEASE_VERSION="1.1"
27+
RELEASE_VERSION="1.1.1"
2828
RELEASE_DIR="release/plik-$(RELEASE_VERSION)"
2929
RELEASE_TARGETS=darwin-386 darwin-amd64 freebsd-386 \
3030
freebsd-amd64 linux-386 linux-amd64 linux-arm openbsd-386 \

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ Plik is an simple and powerful file uploading system written in golang.
1919
- Comments : Add custom message (in Markdown format)
2020

2121
### Version
22-
1.1
22+
1.1.1
2323

2424
### Installation
2525

2626
##### From release
2727
To run plik, it's very simple :
2828
```sh
29-
$ wget https://github.com/root-gg/plik/releases/download/1.1/plik-1.1.tar.gz
30-
$ tar xvf plik-1.1.tar.gz
31-
$ cd plik-1.1/server
29+
$ wget https://github.com/root-gg/plik/releases/download/1.1.1/plik-1.1.1.tar.gz
30+
$ tar xvf plik-1.1.1.tar.gz
31+
$ cd plik-1.1.1/server
3232
$ ./plikd
3333
```
3434
Et voilà ! You now have a fully functional instance of plik running on http://127.0.0.1:8080.

client/plik.go

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ import (
4242
"net/http"
4343
"net/url"
4444
"os"
45-
"path/filepath"
4645
"runtime"
4746
"strconv"
4847
"strings"
@@ -605,13 +604,17 @@ func updateClient(updateFlag bool) (err error) {
605604
return
606605
}
607606

608-
// Download new client
609-
tmpPath := filepath.Dir(path) + "/" + "." + filepath.Base(path) + ".tmp"
610-
tmpFile, err := os.OpenFile(tmpPath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0777)
607+
// Create tmp file
608+
tmpFile, err := ioutil.TempFile("", ".plik_update_")
611609
if err != nil {
612610
return
613611
}
614-
defer tmpFile.Close()
612+
defer func() {
613+
tmpFile.Close()
614+
os.Remove(tmpFile.Name())
615+
}()
616+
617+
// Download new client
615618
URL, err = url.Parse(downloadURL)
616619
if err != nil {
617620
err = fmt.Errorf("Unable to download client : %s", err)
@@ -637,9 +640,14 @@ func updateClient(updateFlag bool) (err error) {
637640
err = fmt.Errorf("Unable to download client : %s", err)
638641
return
639642
}
643+
err = tmpFile.Close()
644+
if err != nil {
645+
err = fmt.Errorf("Unable to download client : %s", err)
646+
return
647+
}
640648

641649
// Check download integrity
642-
downloadMD5, err := utils.FileMd5sum(tmpPath)
650+
downloadMD5, err := utils.FileMd5sum(tmpFile.Name())
643651
if err != nil {
644652
err = fmt.Errorf("Unable to download client : %s", err)
645653
return
@@ -650,7 +658,7 @@ func updateClient(updateFlag bool) (err error) {
650658
}
651659

652660
// Replace old client
653-
err = os.Rename(tmpPath, path)
661+
err = os.Rename(tmpFile.Name(), path)
654662
if err != nil {
655663
err = fmt.Errorf("Unable to replace client : %s", err)
656664
return

server/metadataBackend/file/file.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,8 @@ func (fmb *MetadataBackend) GetUploadsToRemove(ctx *common.PlikContext) (ids []s
321321
// Get upload metadata
322322
upload, err := fmb.Get(ctx, uploadDirectory.Name())
323323
if err != nil {
324-
return ids, err
324+
ctx.EWarningf("Unable to get upload metadata %s : %s", uploadDirectory.Name(), err)
325+
continue
325326
}
326327

327328
// If a TTL is set, test if expired or not

server/public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
<div class="row">
5151
<!-- HEADER LEFT -->
5252
<div class="col-sm-3 text-center">
53-
<h1><a href="/">Plik</a></h1>
53+
<h1><a href="#/_">Plik</a></h1>
5454
</div>
5555
<!-- HEADER RIGHT -->
5656
<div class="col-sm-9 text-right hidden-xs hidden-sm">

0 commit comments

Comments
 (0)