@@ -86,10 +86,8 @@ public Flux<Attachment> getChildren(Long driverId, Long pid, String remotePath)
8686 }
8787
8888 pan115Repository .refreshHttpHeaders (driver .getAccessToken ());
89- List <Pan115Attachment > pan115Attachments =
90- pan115Repository .openUFileFiles (cid , listPageSize .intValue (), 1 , 1 );
9189
92- return Flux . fromStream ( pan115Attachments . stream () );
90+ return pan115Repository . openUFileFiles ( cid , listPageSize . intValue (), 1 , 1 );
9391 })
9492 .map (att -> {
9593 final String fid = att .getFid ();
@@ -137,7 +135,7 @@ public Mono<String> parseReadUrl(Attachment attachment) {
137135 if (FileUtils .isImage (name )) {
138136 return checkoutMono .map (driver -> attachment .getUrl ());
139137 } else if (FileUtils .isVideo (name )) {
140- return checkoutMono .map (driver -> pan115Repository .openVideoPlay (attachment .getUrl ()));
138+ return checkoutMono .flatMap (driver -> pan115Repository .openVideoPlay (attachment .getUrl ()));
141139 } else if (FileUtils .isVoice (name )) {
142140 return parseDownloadUrl (attachment );
143141 } else {
@@ -158,7 +156,7 @@ public Mono<String> parseDownloadUrl(Attachment attachment) {
158156 return checkoutMono .map (driver -> attachment .getUrl ());
159157 } else {
160158 // not image
161- return checkoutMono .map (driver -> pan115Repository .openUFileDownUrl (attachment .getUrl ()));
159+ return checkoutMono .flatMap (driver -> pan115Repository .openUFileDownUrl (attachment .getUrl ()));
162160 }
163161 }
164162
@@ -168,8 +166,8 @@ public Flux<DataBuffer> getSteam(Attachment attachment) {
168166 AttachmentType type = attachment .getType ();
169167 if (AttachmentType .Driver_Directory .equals (type )) return Flux .empty ();
170168 Long driverId = attachment .getDriverId ();
171- Mono < AttachmentDriver > checkoutMono = checkoutToken (driverId );
172- return checkoutMono .flatMapMany (driver -> pan115Repository .openUFileSteam (attachment .getUrl ()));
169+ return checkoutToken (driverId )
170+ .flatMapMany (driver -> pan115Repository .openUFileSteam (attachment .getUrl ()));
173171 }
174172
175173 @ Override
@@ -178,8 +176,7 @@ public Flux<DataBuffer> getSteam(Attachment attachment, long start, long end) {
178176 AttachmentType type = attachment .getType ();
179177 if (AttachmentType .Driver_Directory .equals (type )) return Flux .empty ();
180178 Long driverId = attachment .getDriverId ();
181- Mono <AttachmentDriver > checkoutMono = checkoutToken (driverId );
182- return checkoutMono .flatMapMany (driver ->
179+ return checkoutToken (driverId ).flatMapMany (driver ->
183180 pan115Repository .openUFileSteamWithRange (attachment .getUrl (), start , end ));
184181 }
185182
0 commit comments