Handle details of unknown apps
authorChristian Weiske <cweiske@cweiske.de>
Mon, 25 Nov 2019 20:58:54 +0000 (21:58 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Mon, 25 Nov 2019 20:58:54 +0000 (21:58 +0100)
www/.htaccess
www/api/v1/details-dummy/.htaccess [new file with mode: 0644]
www/api/v1/details-dummy/error-unknown-app-details.json [new file with mode: 0644]

index 0396ea8..8a4bbaf 100644 (file)
@@ -2,7 +2,11 @@ RewriteEngine on
 
 #rewrite details GET parameter
 RewriteCond %{QUERY_STRING} ^app=([^&]+)
-RewriteRule ^api/v1/details /api/v1/details-data/%1.json?
+RewriteCond %{DOCUMENT_ROOT}/api/v1/details-data/%1.json -f
+RewriteRule ^api/v1/details /api/v1/details-data/%1.json? [END]
+
+# details for unknown apps. Also see .htaccess in the dummy dir
+RewriteRule ^api/v1/details /api/v1/details-dummy/404? [END]
 
 RewriteRule ^api/v1/apps/(.*)/download$ /api/v1/apps/$1-download.json? [END]
 RewriteRule ^api/v1/apps/(.*)$ /api/v1/apps/$1.json? [END]
diff --git a/www/api/v1/details-dummy/.htaccess b/www/api/v1/details-dummy/.htaccess
new file mode 100644 (file)
index 0000000..bc2d6fd
--- /dev/null
@@ -0,0 +1,2 @@
+DirectoryIndex index.html
+ErrorDocument 404 /api/v1/details-dummy/error-unknown-app-details.json
diff --git a/www/api/v1/details-dummy/error-unknown-app-details.json b/www/api/v1/details-dummy/error-unknown-app-details.json
new file mode 100644 (file)
index 0000000..b412ad3
--- /dev/null
@@ -0,0 +1,6 @@
+{
+  "error": {
+    "message": "Unknown application",
+    "code": 2005
+  }
+}