diff --git a/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc b/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc
index d6343e1..52cfaf3 100644
Binary files a/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc and b/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc differ
diff --git a/standards/templatetags/counter_tag.py b/standards/templatetags/counter_tag.py
index 1500a18..d704275 100644
--- a/standards/templatetags/counter_tag.py
+++ b/standards/templatetags/counter_tag.py
@@ -1181,40 +1181,46 @@ def getNCDirInfosURL(request, ncid):
@register.simple_tag
def getAGGroupQuotaData(request):
r = requests.request("PROPFIND", settings.NEXTCLOUD_URL + "remote.php/dav/files/" + request.user.username + "/Agenturdaten", headers={'Content-Type' : 'text/xml', 'Authorization' : "Bearer " + request.user.profile.nc_sid})
-
- # IN USE
- split_response = r.text.split("")
- inuse = split_response[1].split("")[0]
-
- # QUOTA
- split_response = r.text.split("")
- quota = split_response[1].split("")[0]
+ try:
+ # IN USE
+ split_response = r.text.split("")
+ inuse = split_response[1].split("")[0]
+
+ # QUOTA
+ split_response = r.text.split("")
+ quota = split_response[1].split("")[0]
- # PERCENT VALUE
- percent = (100 / int(quota))*int(inuse)
+ # PERCENT VALUE
+ percent = (100 / int(quota))*int(inuse)
+ return [quota, inuse, str(round(percent, 0)).replace(",", ".")]
+ except:
+ return [0, 0, 0]
- return [quota, inuse, str(round(percent, 0)).replace(",", ".")]
+
+
# User QUOTA
import re, math
@register.simple_tag
def getUserQuotaData(userdata):
r = requests.request("GET", settings.NEXTCLOUD_URL + "/ocs/v1.php/cloud/users/" + userdata.username, auth=(settings.NEXTCLOUD_USER_API, settings.NEXTCLOUD_PW_API), headers={'Content-Type' : 'text/xml', 'OCS-APIRequest': "true"})
+ try:
+ quotadata = [int(s) for s in re.findall('(.+?)', r.text)]
+ inuse = [int(s) for s in re.findall('(.+?)', r.text)]
+
+ quotadata_value = quotadata[0]
+ valuequota_MB = 0
+ counter = 0
+ while(quotadata_value > 9999 or counter > 3):
+ quotadata_value = quotadata_value / 1024
+ counter += 1
+
+ valuequota_MB = round(quotadata_value, 0)
- quotadata = [int(s) for s in re.findall('(.+?)', r.text)]
- inuse = [int(s) for s in re.findall('(.+?)', r.text)]
-
- quotadata_value = quotadata[0]
- valuequota_MB = 0
- counter = 0
- while(quotadata_value > 9999 or counter > 3):
- quotadata_value = quotadata_value / 1024
- counter += 1
-
- valuequota_MB = round(quotadata_value, 0)
+ # PERCENT
+ percent = (100 / int(quotadata[0]))*int(inuse[0])
- # PERCENT
- percent = (100 / int(quotadata[0]))*int(inuse[0])
-
- return [quotadata[0], inuse[0], str(round(percent, 0)).replace(",", "."), str(valuequota_MB).split(".")[0]]
+ return [quotadata[0], inuse[0], str(round(percent, 0)).replace(",", "."), str(valuequota_MB).split(".")[0]]
+ except:
+ return [0, 0, 0, 0]