diff --git a/.gitignore b/.gitignore
index e8c91ff..507ae28 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@ node_modules/
.DS_Store
cbFiles
data
+__debug*
\ No newline at end of file
diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 0000000..82fdfb8
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,15 @@
+{
+ // Use IntelliSense to learn about possible attributes.
+ // Hover to view descriptions of existing attributes.
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "name": "Launch cbFiles",
+ "type": "go",
+ "request": "launch",
+ "mode": "auto",
+ "program": "${workspaceFolder}/server",
+ }
+ ]
+}
\ No newline at end of file
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
new file mode 100644
index 0000000..f77d4dd
--- /dev/null
+++ b/.vscode/tasks.json
@@ -0,0 +1,11 @@
+{
+ "version": "2.0.0",
+ "tasks": [
+ {
+ "type": "npm",
+ "script": "start",
+ "path": "web",
+ "problemMatcher": [],
+ "label": "npm: dev - html", }
+ ]
+}
\ No newline at end of file
diff --git a/server/handlers/handlers.go b/server/handlers/handlers.go
index 2e5e425..50e26ed 100644
--- a/server/handlers/handlers.go
+++ b/server/handlers/handlers.go
@@ -17,7 +17,7 @@ func HandleUpload(w http.ResponseWriter, r *http.Request) {
shareId := r.URL.Query().Get("shareId")
// Check if share exists
- sharePath := path.Join("data", "share", shareId)
+ sharePath := path.Join("data", "share", path.Join("/", shareId))
if _, err := os.Stat(sharePath); os.IsNotExist(err) {
fmt.Println(" The share does not exist, creation is done from Home page. Canceling upload")
return
@@ -40,7 +40,7 @@ func HandleUpload(w http.ResponseWriter, r *http.Request) {
}
defer fileChunk.Close()
- tempFilePath := path.Join(sharePath, fileName)
+ tempFilePath := path.Join(sharePath, path.Join("/", fileName))
tempFile, err := os.OpenFile(tempFilePath, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
fmt.Println(" Error opening or creating temp file :")
@@ -73,7 +73,7 @@ func HandleSearch(w http.ResponseWriter, r *http.Request) {
// Obtain shareId and Path from URL
shareId := r.URL.Query().Get("shareId")
- sharePath := path.Join("data", "share", shareId)
+ sharePath := path.Join("data", "share", path.Join("/", shareId))
fmt.Println(" Searching for share", shareId)
@@ -143,11 +143,11 @@ func HandleDelete(w http.ResponseWriter, r *http.Request) {
// Obtain shareId and Path from URL
shareId := r.URL.Query().Get("shareId")
- sharePath := path.Join("data", "share", shareId)
+ sharePath := path.Join("data", "share", path.Join("/", shareId))
// Obtain fileName and filePath from URL
fileName := r.URL.Query().Get("fileName")
- filePath := path.Join(sharePath, fileName)
+ filePath := path.Join(sharePath, path.Join("/", fileName))
fmt.Println(" Deleting file", fileName, "from share", shareId, "...")
@@ -170,11 +170,11 @@ func HandleDownload(w http.ResponseWriter, r *http.Request) {
// Obtain shareId and Path from URL
shareId := r.URL.Query().Get("shareId")
- sharePath := path.Join("data", "share", shareId)
+ sharePath := path.Join("data", "share", path.Join("/", shareId))
// Obtain fileName and filePath from URL
fileName := r.URL.Query().Get("fileName")
- filePath := path.Join(sharePath, fileName)
+ filePath := path.Join(sharePath, path.Join("/", fileName))
fmt.Println(" Downloading file", fileName, "from share", shareId, "...")
@@ -264,7 +264,7 @@ func HandleCreate(w http.ResponseWriter, r *http.Request) {
// ...and send it
w.Header().Set("Content-Type", "application/json")
- w.Write(responseJSON)
+ _, _ = w.Write(responseJSON)
fmt.Println("Share created!")
}
diff --git a/web/embed.go b/web/embed.go
index a9bd630..4443449 100644
--- a/web/embed.go
+++ b/web/embed.go
@@ -17,4 +17,4 @@ func GetUiFs() fs.FS {
}
return embedRoot
// return http.FileServer(http.FS(embedRoot))
-}
\ No newline at end of file
+}
diff --git a/web/package.json b/web/package.json
index c3c1f32..b162711 100644
--- a/web/package.json
+++ b/web/package.json
@@ -45,5 +45,6 @@
},
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "^7.21.11"
- }
+ },
+ "proxy": "http://localhost:8080"
}
diff --git a/web/src/components/CbFiles.js b/web/src/components/CbFiles.js
index 4ca8e04..a0840df 100644
--- a/web/src/components/CbFiles.js
+++ b/web/src/components/CbFiles.js
@@ -28,7 +28,7 @@ export function CbFiles({ fileInfo, viewMode, loadFiles, searchTerms }) {
if (viewMode === "gallery") {
const newComponents = filteredfileInfo.map((item) => (
-