application/davcontroller.c

changeset 53
da05df77652e
parent 52
0c881944fa10
child 54
3ca3acefc66a
--- a/application/davcontroller.c	Mon Oct 21 11:14:26 2024 +0200
+++ b/application/davcontroller.c	Mon Oct 21 13:22:45 2024 +0200
@@ -201,31 +201,28 @@
     }
 }
 
-void davbrowser_open_resource(UiObject *ui, DavBrowser *browser, DavResource *res) {
-    char *url = util_concat_path(browser->sn->base_url, res->path);
-    void *x = cxMapGet(browser->res_open_inprogress, url);
-    free(url);
-    if(x) {
-        return; // open resource already in progress
+void davbrowser_open_resource(UiObject *ui, DavBrowser *browser, DavResource *res, const char *contenttype) {
+    DavResourceViewType type = DAV_RESOURCE_VIEW_PROPERTIES;
+    if(!contenttype) {
+        contenttype = res->contenttype;
     }
     
-    DavResourceViewType type = DAV_RESOURCE_VIEW_PROPERTIES;
     if(res->iscollection) {
         // default type
-    } else if(res->contenttype) {
-        cxstring contenttype = cx_str(res->contenttype);
-        if(cx_strprefix(contenttype, CX_STR("text/"))) {
+    } else if(contenttype) {
+        cxstring ctype = cx_str(contenttype);
+        if(cx_strprefix(ctype, CX_STR("text/"))) {
             type = DAV_RESOURCE_VIEW_TEXT;
-        } else if(cx_strprefix(contenttype, CX_STR("image/"))) {
+        } else if(cx_strprefix(ctype, CX_STR("image/"))) {
             type = DAV_RESOURCE_VIEW_IMAGE;
-        } else if(cx_strprefix(contenttype, CX_STR("application/"))) {
-            if(cx_strsuffix(contenttype, CX_STR("json"))) {
+        } else if(cx_strprefix(ctype, CX_STR("application/"))) {
+            if(cx_strsuffix(ctype, CX_STR("json"))) {
                 type = DAV_RESOURCE_VIEW_TEXT;
-            } else if(cx_strsuffix(contenttype, CX_STR("/xml"))) {
+            } else if(cx_strsuffix(ctype, CX_STR("/xml"))) {
                 type = DAV_RESOURCE_VIEW_TEXT;
-            } else if(cx_strsuffix(contenttype, CX_STR("+xml"))) {
+            } else if(cx_strsuffix(ctype, CX_STR("+xml"))) {
                 type = DAV_RESOURCE_VIEW_TEXT;
-            } else if(cx_strsuffix(contenttype, CX_STR("/xml"))) {
+            } else if(cx_strsuffix(ctype, CX_STR("/xml"))) {
                 type = DAV_RESOURCE_VIEW_TEXT;
             }
         }

mercurial