wrap up url escape bug; fix pausedUP bug
This commit is contained in:
@@ -8,7 +8,6 @@ import (
|
|||||||
"github.com/sirrobot01/decypharr/pkg/debrid/types"
|
"github.com/sirrobot01/decypharr/pkg/debrid/types"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
|
||||||
"os"
|
"os"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -25,7 +24,6 @@ type fileInfo struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (fi *fileInfo) Name() string { return utils.EscapePath(fi.name) }
|
func (fi *fileInfo) Name() string { return utils.EscapePath(fi.name) }
|
||||||
func (fi *fileInfo) RawName() string { return url.PathEscape(fi.name) }
|
|
||||||
func (fi *fileInfo) Size() int64 { return fi.size }
|
func (fi *fileInfo) Size() int64 { return fi.size }
|
||||||
func (fi *fileInfo) Mode() os.FileMode { return fi.mode }
|
func (fi *fileInfo) Mode() os.FileMode { return fi.mode }
|
||||||
func (fi *fileInfo) ModTime() time.Time { return fi.modTime }
|
func (fi *fileInfo) ModTime() time.Time { return fi.modTime }
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<select class="form-select form-select-sm d-inline-block w-auto me-2" id="stateFilter" style="flex-shrink: 0;">
|
<select class="form-select form-select-sm d-inline-block w-auto me-2" id="stateFilter" style="flex-shrink: 0;">
|
||||||
<option value="">All States</option>
|
<option value="">All States</option>
|
||||||
<option value="pausedup">Completed</option>
|
<option value="pausedUP">PausedUP(Completed)</option>
|
||||||
<option value="downloading">Downloading</option>
|
<option value="downloading">Downloading</option>
|
||||||
<option value="error">Error</option>
|
<option value="error">Error</option>
|
||||||
</select>
|
</select>
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
torrents: [],
|
torrents: [],
|
||||||
selectedTorrents: new Set(),
|
selectedTorrents: new Set(),
|
||||||
categories: new Set(),
|
categories: new Set(),
|
||||||
states: new Set('downloading', 'pausedup', 'error'),
|
states: new Set('downloading', 'pausedUP', 'error'),
|
||||||
selectedCategory: refs.categoryFilter?.value || '',
|
selectedCategory: refs.categoryFilter?.value || '',
|
||||||
selectedState: refs.stateFilter?.value || '',
|
selectedState: refs.stateFilter?.value || '',
|
||||||
sortBy: refs.sortSelector?.value || 'added_on',
|
sortBy: refs.sortSelector?.value || 'added_on',
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package webdav
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/sirrobot01/decypharr/internal/utils"
|
"github.com/sirrobot01/decypharr/internal/utils"
|
||||||
"net/url"
|
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@@ -17,7 +16,6 @@ type FileInfo struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (fi *FileInfo) Name() string { return utils.EscapePath(fi.name) } // uses minimal escaping
|
func (fi *FileInfo) Name() string { return utils.EscapePath(fi.name) } // uses minimal escaping
|
||||||
func (fi *FileInfo) RawName() string { return url.PathEscape(fi.name) } // uses full escaping
|
|
||||||
func (fi *FileInfo) Size() int64 { return fi.size }
|
func (fi *FileInfo) Size() int64 { return fi.size }
|
||||||
func (fi *FileInfo) Mode() os.FileMode { return fi.mode }
|
func (fi *FileInfo) Mode() os.FileMode { return fi.mode }
|
||||||
func (fi *FileInfo) ModTime() time.Time { return fi.modTime }
|
func (fi *FileInfo) ModTime() time.Time { return fi.modTime }
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
path "path/filepath"
|
path "path/filepath"
|
||||||
"slices"
|
"slices"
|
||||||
@@ -465,6 +466,13 @@ func (h *Handler) serveDirectory(w http.ResponseWriter, r *http.Request, file we
|
|||||||
"add": func(a, b int) int {
|
"add": func(a, b int) int {
|
||||||
return a + b
|
return a + b
|
||||||
},
|
},
|
||||||
|
"urlpath": func(p string) string {
|
||||||
|
segments := strings.Split(p, "/")
|
||||||
|
for i, segment := range segments {
|
||||||
|
segments[i] = url.PathEscape(segment)
|
||||||
|
}
|
||||||
|
return strings.Join(segments, "/")
|
||||||
|
},
|
||||||
"formatSize": func(bytes int64) string {
|
"formatSize": func(bytes int64) string {
|
||||||
const (
|
const (
|
||||||
KB = 1024
|
KB = 1024
|
||||||
|
|||||||
@@ -109,11 +109,11 @@ const directoryTemplate = `
|
|||||||
<h1>Index of {{.Path}}</h1>
|
<h1>Index of {{.Path}}</h1>
|
||||||
<ul>
|
<ul>
|
||||||
{{if .ShowParent}}
|
{{if .ShowParent}}
|
||||||
<li><a href="{{ .ParentPath}}" class="parent-dir"><span class="file-number"></span>Parent Directory</a></li>
|
<li><a href="{{urlpath .ParentPath}}" class="parent-dir"><span class="file-number"></span>Parent Directory</a></li>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{range $index, $file := .Children}}
|
{{range $index, $file := .Children}}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{(printf "%s/%s" $.Path $file.RawName )}}">
|
<a href="{{urlpath (printf "%s/%s" $.Path $file.Name)}}">
|
||||||
<span class="file-number">{{add $index 1}}.</span>
|
<span class="file-number">{{add $index 1}}.</span>
|
||||||
<span class="file-name">{{$file.Name}}{{if $file.IsDir}}/{{end}}</span>
|
<span class="file-name">{{$file.Name}}{{if $file.IsDir}}/{{end}}</span>
|
||||||
<span class="file-info">
|
<span class="file-info">
|
||||||
|
|||||||
Reference in New Issue
Block a user