♻️ Refactor: Remove unused variables
This commit is contained in:
parent
d687608ba8
commit
4527be0328
2 changed files with 9 additions and 9 deletions
12
list.go
12
list.go
|
@ -17,7 +17,7 @@ func ListFiles(w http.ResponseWriter, r *http.Request) {
|
|||
userSession, err := validateSession(w, r)
|
||||
if err != nil {
|
||||
// Handle the error as needed
|
||||
handleInternalServerError(w, err)
|
||||
handleInternalServerError(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ func ListFiles(w http.ResponseWriter, r *http.Request) {
|
|||
// Other error occurred while opening the directory
|
||||
log.Printf("Error opening user directory: %v", err)
|
||||
// Handle the error as needed
|
||||
handleInternalServerError(w, err)
|
||||
handleInternalServerError(err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ func ListFiles(w http.ResponseWriter, r *http.Request) {
|
|||
if err != nil {
|
||||
log.Printf("Error reading file names in directory: %v", err)
|
||||
// Handle the error as needed
|
||||
handleInternalServerError(w, err)
|
||||
handleInternalServerError(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ func ListFiles(w http.ResponseWriter, r *http.Request) {
|
|||
if err != nil {
|
||||
log.Printf("Error getting user UUID: %v", err)
|
||||
// Handle the error as needed
|
||||
handleInternalServerError(w, err)
|
||||
handleInternalServerError(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ func ListFiles(w http.ResponseWriter, r *http.Request) {
|
|||
if err != nil {
|
||||
log.Printf("Error inserting file into the database: %v", err)
|
||||
// Handle the error as needed
|
||||
handleInternalServerError(w, err)
|
||||
handleInternalServerError(err)
|
||||
return
|
||||
}
|
||||
http.Redirect(w, r, "/home", http.StatusSeeOther)
|
||||
|
@ -282,7 +282,7 @@ func DeleteFiles(w http.ResponseWriter, r *http.Request) {
|
|||
fmt.Println("File to delete:", filename)
|
||||
}
|
||||
if err := json.NewDecoder(r.Body).Decode(&request); err != nil {
|
||||
http.Error(w, "Bad Request", http.StatusBadRequest)
|
||||
http.Error(w, "Bad Request, make an issue at https://git.privacyquest.net", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
6
main.go
6
main.go
|
@ -84,7 +84,7 @@ func main() {
|
|||
exists := checkDatabaseExists(db, dbName)
|
||||
|
||||
if !exists {
|
||||
createDatabase(db, dbName)
|
||||
createDatabase(db)
|
||||
}
|
||||
|
||||
db = connectToNotatioDatabase(dbHost, dbPort, dbUser, dbPassword, dbName, dbSSLMode)
|
||||
|
@ -167,7 +167,7 @@ func handleUsernameCheck(w http.ResponseWriter, r *http.Request) {
|
|||
w.Write(jsonResponse)
|
||||
}
|
||||
|
||||
func handleInternalServerError(w http.ResponseWriter, err error) {
|
||||
func handleInternalServerError(err error) {
|
||||
log.Printf("Error: %v", err)
|
||||
}
|
||||
|
||||
|
@ -313,7 +313,7 @@ func checkDatabaseExists(db *sql.DB, dbName string) bool {
|
|||
return exists
|
||||
}
|
||||
|
||||
func createDatabase(db *sql.DB, dbName string) {
|
||||
func createDatabase(db *sql.DB) {
|
||||
log.Println("Notatio database does not exist. Creating Database...")
|
||||
_, err := db.Exec("CREATE DATABASE notatio")
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue