Upload File Bug fix

This commit is contained in:
Holger Trampe 2021-09-16 15:38:35 +02:00
parent 932b7baf4b
commit ff7abb0fde
1 changed files with 4 additions and 2 deletions

View File

@ -825,6 +825,8 @@ def StandardChangePublic(request, pk):
standard.save()
return redirect('standards')
# TODO: Upload der Standard-Dateien passt noch nicht, BUG!!!!
@login_required
def StandardSingle(request, pk):
@ -1214,9 +1216,9 @@ def uploadFileFromStandard(request):
file_ok = True
if(file_ok):
final_file_path = settings.NEXTCLOUD_URL + "remote.php/dav/files/admin/Agenturdaten/Standards Uploadbereich/" + request.FILES['uploadedfile'].name
final_file_path = settings.NEXTCLOUD_URL + "remote.php/dav/files/" + request.user.username + "/Agenturdaten/Standards Uploadbereich/" + request.FILES['uploadedfile'].name
r = requests.put(final_file_path, data=request.FILES['uploadedfile'], auth=(settings.NEXTCLOUD_USER_API, settings.NEXTCLOUD_PW_API))
r = requests.put(final_file_path, data=request.FILES['uploadedfile'], headers={'Content-Type' : 'text/xml;', 'Authorization' : "Bearer " + request.user.profile.nc_sid})
if(len(r.text) == 0):
try:
new_file_name = request.FILES['uploadedfile'].name