|
6 | 6 | import org.springframework.util.Assert; |
7 | 7 | import reactor.core.publisher.Flux; |
8 | 8 | import reactor.core.publisher.Mono; |
| 9 | +import run.ikaros.api.constant.OpenApiConst; |
9 | 10 | import run.ikaros.api.core.attachment.Attachment; |
10 | 11 | import run.ikaros.api.core.attachment.AttachmentDriver; |
11 | 12 | import run.ikaros.api.core.attachment.AttachmentDriverFetcher; |
@@ -131,17 +132,18 @@ public Mono<String> parseReadUrl(Attachment attachment) { |
131 | 132 | if (AttachmentType.Driver_Directory.equals(type)) return Mono.just(attachment.getUrl()); |
132 | 133 | String name = attachment.getName(); |
133 | 134 | Long driverId = attachment.getDriverId(); |
134 | | - Mono<AttachmentDriver> checkoutMono = checkoutToken(driverId); |
135 | | - if (FileUtils.isImage(name)) { |
136 | | - return checkoutMono.map(driver -> attachment.getUrl()); |
137 | | - } else if (FileUtils.isVideo(name)) { |
138 | | - return checkoutMono.flatMap(driver -> pan115Repository.openVideoPlay(attachment.getUrl())); |
139 | | - } else if (FileUtils.isVoice(name)) { |
140 | | - return parseDownloadUrl(attachment); |
141 | | - } else { |
142 | | - // doc |
143 | | - return checkoutMono.map(driver -> attachment.getUrl()); |
144 | | - } |
| 135 | + final String attStreamUrl = OpenApiConst.ATT_STREAM_ENDPOINT_PREFIX + '/' + attachment.getId(); |
| 136 | + return checkoutToken(driverId).map(driver -> attStreamUrl); |
| 137 | + // if (FileUtils.isImage(name)) { |
| 138 | + // return checkoutMono.map(driver -> attachment.getUrl()); |
| 139 | + // } else if (FileUtils.isVideo(name)) { |
| 140 | + // return checkoutMono.flatMap(driver -> pan115Repository.openVideoPlay(attachment.getUrl())); |
| 141 | + // } else if (FileUtils.isVoice(name)) { |
| 142 | + // return parseDownloadUrl(attachment); |
| 143 | + // } else { |
| 144 | + // // doc |
| 145 | + // return checkoutMono.map(driver -> attachment.getUrl()); |
| 146 | + // } |
145 | 147 | } |
146 | 148 |
|
147 | 149 | @Override |
|
0 commit comments