2 コミット a79beb80f0 ... 4002087845

作者 SHA1 メッセージ 日付
  herlanS_ 4002087845 Merge remote-tracking branch 'origin/master' 3 年 前
  herlanS_ c80715b967 fix submitfilename null 3 年 前

+ 31 - 0
docker-compose.yml

@@ -0,0 +1,31 @@
+version: "3.9"
+services:
+  bridge:
+    image: maven:3.8.1-jdk-8
+    container_name: bridge2
+    restart: always
+    environment:
+      - PORT=9091
+    labels:
+      - autoheal=true
+    working_dir: /usr/src/mymaven
+    volumes:
+      - ./ipphone-bridge:/usr/src/mymaven
+      - ./.m2:/root/.m2
+    ports:
+      - "9091:9091"
+    healthcheck:
+      test: ["CMD", "curl", "-f", "http://localhost:9091/actuator/health"]
+      interval: 10s
+      timeout: 10s
+      retries: 3
+      start_period: 60s
+    command: mvn spring-boot:run
+  autoheal:
+    image: willfarrell/autoheal
+    container_name: autoheal-bridge2
+    volumes:
+      - '/var/run/docker.sock:/var/run/docker.sock'
+    environment:
+      - AUTOHEAL_INTERVAL=10
+      - CURL_TIMEOUT=30

+ 7 - 1
src/main/kotlin/co/id/datacomsolusindo/ipphonebridge/BridgeFIlter.kt

@@ -98,8 +98,14 @@ class BridgeFilter(private val template: SimpMessagingTemplate, val resourceLoad
                     if (req.contentType != null && req.contentType.toLowerCase().indexOf("multipart/form-data") > -1) {
                         rb.parts =
                             req.parts.map {
+                                val subFilename = if (it.submittedFileName == null) {
+                                    UUID.randomUUID().toString().take(5)
+                                } else {
+                                    it.submittedFileName
+                                }
+
                                 val fb64 = Base64.getEncoder().encodeToString(it.inputStream.readBytes())
-                                FilePart(it.name, it.submittedFileName, fb64)
+                                FilePart(it.name, subFilename, fb64)
                             }.toMutableList()
                     } else {
                         val body = req.reader.lines().toList().joinToString(System.lineSeparator())