to handle both cases you can do-
allowed_extensions = request.POST.getlist("allowed-extension[]") or request.POST.get("allowed-extensions", "").split(",")
allowed_extensions = [ext.strip() for ext in allowed_extensions if ext.strip()] # this will clean up your white space