From a5a68a8944eb6cadcdb434d42c60e4adc2ae203b Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Sun, 30 Jul 2017 09:21:17 +0100 Subject: [PATCH] Version flag; close #175; improve error logging Fix #175 improve error logging build assets Former-commit-id: c0feee879514a18dabe649368ac16895acf71f5a [formerly 644474964c42dc7ac3684059baa72d4f974c3fc1] [formerly df7e47d330f713c717f04a66430c895dce6933e4 [formerly 24dbcb87ba3ff0d3788d9f9e8cb1d9bbaa092d5e]] Former-commit-id: d864fca67e2c39ea0dd94a61ee89515de700284d [formerly fc3cba4628faaef6ae99562b7b236e82ccf20589] Former-commit-id: dd20e74775af0e4e2232a2fda3dd1bba169ce165 --- assets/src/components/Files.vue | 3 +++ cmd/filemanager/main.go | 8 ++++++++ filemanager.go | 5 +++-- rice-box.go.REMOVED.git-id | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/assets/src/components/Files.vue b/assets/src/components/Files.vue index 65309c65..38924647 100644 --- a/assets/src/components/Files.vue +++ b/assets/src/components/Files.vue @@ -131,6 +131,9 @@ export default { beforeDestroy () { window.removeEventListener('keydown', this.keyEvent) }, + destroyed () { + this.$store.commit('updateRequest', {}) + }, methods: { ...mapMutations([ 'setLoading' ]), fetchData () { diff --git a/cmd/filemanager/main.go b/cmd/filemanager/main.go index 6848c36a..75937beb 100644 --- a/cmd/filemanager/main.go +++ b/cmd/filemanager/main.go @@ -32,6 +32,8 @@ var ( allowCommands bool allowEdit bool allowNew bool + showVer bool + version = "master" ) func init() { @@ -46,6 +48,7 @@ func init() { flag.BoolVar(&allowEdit, "allow-edit", true, "Default allow edit option for new users") flag.BoolVar(&allowNew, "allow-new", true, "Default allow new option for new users") flag.StringVar(&plugin, "plugin", "", "Plugin you want to enable") + flag.BoolVarP(&showVer, "version", "v", false, "Show version") } func setupViper() { @@ -79,6 +82,11 @@ func main() { setupViper() flag.Parse() + if showVer { + fmt.Println("filemanager version", version) + os.Exit(0) + } + // Add a configuration file if set. if config != "" { ext := filepath.Ext(config) diff --git a/filemanager.go b/filemanager.go index f92b03f0..92c15d3c 100644 --- a/filemanager.go +++ b/filemanager.go @@ -440,8 +440,9 @@ func (m *FileManager) ServeHTTP(w http.ResponseWriter, r *http.Request) { log.Print(err) w.Write([]byte(err.Error())) } else { - log.Print(code) - w.Write([]byte(http.StatusText(code))) + txt := http.StatusText(code) + log.Printf("%v: %v %v\n", r.URL.Path, code, txt) + w.Write([]byte(txt)) } } } diff --git a/rice-box.go.REMOVED.git-id b/rice-box.go.REMOVED.git-id index 11c86299..18bc6310 100644 --- a/rice-box.go.REMOVED.git-id +++ b/rice-box.go.REMOVED.git-id @@ -1 +1 @@ -261f3077300416639c340ca30538b4c40284dd00 \ No newline at end of file +49dd472ced00d5e02963554cd0b84393f8c08d75 \ No newline at end of file