Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nur site.zip wird akzeptiert #3

Open
BachErik opened this issue Feb 6, 2023 · 2 comments
Open

nur site.zip wird akzeptiert #3

BachErik opened this issue Feb 6, 2023 · 2 comments

Comments

@BachErik
Copy link
Owner

BachErik commented Feb 6, 2023

Aktuell wird nur eine zip mit dem Namen site.zip akzeptiert. (Hardcoded)

@BachErik
Copy link
Owner Author

BachErik commented Feb 14, 2023

Mit diesem Code sollte der Bug behoben sein.

func showIndexForm(w http.ResponseWriter, r *http.Request) {
	cookie, err := r.Cookie("GUID")
	if err != nil {
		http.ServeFile(w, r, "upload.html")
		return
	}

	guid := cookie.Value
	if _, err := os.Stat(guid); os.IsNotExist(err) {
		// folder with GUID does not exist, create it
		err = os.Mkdir(guid, 0700)
		if err != nil {
			http.Error(w, err.Error(), http.StatusInternalServerError)
			return
		}
		
		// Unzip zip
		err = os.Mkdir(guid+"/unzipped", 0700)
		if err != nil {
			http.Error(w, err.Error(), http.StatusInternalServerError)
			return
		}
		fmt.Println(guid + "/site.zip")
		fmt.Println(guid + "/unzipped")
		error := unzip(guid+"/site.zip", guid+"/unzipped")
		if error != nil {
			log.Fatal(err)
		}
	} else if err == nil {
		// folder with GUID exists, do nothing
	}

	http.ServeFile(w, r, "index.html")
}

@BachErik BachErik reopened this Feb 14, 2023
@BachErik
Copy link
Owner Author

Nein funktioniert nicht.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant