A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
feat(upload): add support for attachment uploads and improve image handling
LinkinStars21655f68184c
diff --git a/docs/docs.go b/docs/docs.goindex 424bd669..9e21f05b 100644--- a/docs/docs.go+++ b/docs/docs.go@@ -3145,6 +3145,7 @@ const docTemplate = `{{"enum": ["post",+ "post_attachment","avatar","branding"],@@ -4483,7 +4484,8 @@ const docTemplate = `{"hot","score","unanswered",- "recommend"+ "recommend",+ "frequent"],"type": "string","name": "order",@@ -9666,7 +9668,8 @@ const docTemplate = `{"hot","score","unanswered",- "recommend"+ "recommend",+ "frequent"]},"page": {@@ -10641,6 +10644,27 @@ const docTemplate = `{"schema.SiteWriteReq": {"type": "object","properties": {+ "authorized_attachment_extensions": {+ "type": "array",+ "items": {+ "type": "string"+ }+ },+ "authorized_image_extensions": {+ "type": "array",+ "items": {+ "type": "string"+ }+ },+ "max_attachment_size": {+ "type": "integer"+ },+ "max_image_megapixel": {+ "type": "integer"+ },+ "max_image_size": {+ "type": "integer"+ },"recommend_tags": {"type": "array","items": {@@ -10664,6 +10688,27 @@ const docTemplate = `{"schema.SiteWriteResp": {"type": "object","properties": {+ "authorized_attachment_extensions": {+ "type": "array",+ "items": {+ "type": "string"+ }+ },+ "authorized_image_extensions": {+ "type": "array",+ "items": {+ "type": "string"+ }+ },+ "max_attachment_size": {+ "type": "integer"+ },+ "max_image_megapixel": {+ "type": "integer"+ },+ "max_image_size": {+ "type": "integer"+ },"recommend_tags": {"type": "array","items": {diff --git a/docs/swagger.json b/docs/swagger.jsonindex 7ec493b2..9b45f1cf 100644--- a/docs/swagger.json+++ b/docs/swagger.json@@ -3118,6 +3118,7 @@{"enum": ["post",+ "post_attachment","avatar","branding"],@@ -4456,7 +4457,8 @@"hot","score","unanswered",- "recommend"+ "recommend",+ "frequent"],"type": "string","name": "order",@@ -9639,7 +9641,8 @@"hot","score","unanswered",- "recommend"+ "recommend",+ "frequent"]},"page": {@@ -10614,6 +10617,27 @@"schema.SiteWriteReq": {"type": "object","properties": {+ "authorized_attachment_extensions": {+ "type": "array",+ "items": {+ "type": "string"+ }+ },+ "authorized_image_extensions": {+ "type": "array",+ "items": {+ "type": "string"+ }+ },+ "max_attachment_size": {+ "type": "integer"+ },+ "max_image_megapixel": {+ "type": "integer"+ },+ "max_image_size": {+ "type": "integer"+ },"recommend_tags": {"type": "array","items": {@@ -10637,6 +10661,27 @@"schema.SiteWriteResp": {"type": "object","properties": {+ "authorized_attachment_extensions": {+ "type": "array",+ "items": {+ "type": "string"+ }+ },+ "authorized_image_extensions": {+ "type": "array",+ "items": {+ "type": "string"+ }+ },+ "max_attachment_size": {+ "type": "integer"+ },+ "max_image_megapixel": {+ "type": "integer"+ },+ "max_image_size": {+ "type": "integer"+ },"recommend_tags": {"type": "array","items": {diff --git a/docs/swagger.yaml b/docs/swagger.yamlindex 4622e964..b8bade56 100644--- a/docs/swagger.yaml+++ b/docs/swagger.yaml@@ -1556,6 +1556,7 @@ definitions:- score- unanswered- recommend+ - frequenttype: stringpage:minimum: 1@@ -2221,6 +2222,20 @@ definitions:type: objectschema.SiteWriteReq:properties:+ authorized_attachment_extensions:+ items:+ type: string+ type: array+ authorized_image_extensions:+ items:+ type: string+ type: array+ max_attachment_size:+ type: integer+ max_image_megapixel:+ type: integer+ max_image_size:+ type: integerrecommend_tags:items:$ref: '#/definitions/schema.SiteWriteTag'@@ -2236,6 +2251,20 @@ definitions:type: objectschema.SiteWriteResp:properties:+ authorized_attachment_extensions:+ items:+ type: string+ type: array+ authorized_image_extensions:+ items:+ type: string+ type: array+ max_attachment_size:+ type: integer+ max_image_megapixel:+ type: integer+ max_image_size:+ type: integerrecommend_tags:items:$ref: '#/definitions/schema.SiteWriteTag'@@ -4767,6 +4796,7 @@ paths:- description: identify the source of the file uploadenum:- post+ - post_attachment- avatar- brandingin: formData@@ -5601,6 +5631,7 @@ paths:- score- unanswered- recommend+ - frequentin: queryname: ordertype: stringdiff --git a/internal/base/constant/upload.go b/internal/base/constant/upload.goindex 5a884ae7..c01c9279 100644--- a/internal/base/constant/upload.go+++ b/internal/base/constant/upload.go@@ -1,3 +1,22 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one+ * or more contributor license agreements. See the NOTICE file+ * distributed with this work for additional information+ * regarding copyright ownership. The ASF licenses this file+ * to you under the Apache License, Version 2.0 (the+ * "License"); you may not use this file except in compliance+ * with the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing,+ * software distributed under the License is distributed on an+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ * KIND, either express or implied. See the License for the+ * specific language governing permissions and limitations+ * under the License.+ */+package constantconst (diff --git a/ui/src/components/QueryGroup/index.scss b/ui/src/components/QueryGroup/index.scssindex 9ab5b36d..3a05069f 100644--- a/ui/src/components/QueryGroup/index.scss+++ b/ui/src/components/QueryGroup/index.scss@@ -1,3 +1,22 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one+ * or more contributor license agreements. See the NOTICE file+ * distributed with this work for additional information+ * regarding copyright ownership. The ASF licenses this file+ * to you under the Apache License, Version 2.0 (the+ * "License"); you may not use this file except in compliance+ * with the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing,+ * software distributed under the License is distributed on an+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ * KIND, either express or implied. See the License for the+ * specific language governing permissions and limitations+ * under the License.+ */+.md-show {display: flex !important;}