|
@@ -7,6 +7,7 @@ import java.util.Map;
|
|
|
|
|
|
import com.ksyun.ks3.dto.PostObjectFormFields;
|
|
|
import com.yonge.toolset.thirdparty.entity.UploadSign;
|
|
|
+import com.yonge.toolset.thirdparty.storage.provider.KS3StoragePlugin;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import com.yonge.toolset.base.exception.ThirdpartyException;
|
|
@@ -38,6 +39,23 @@ public class StoragePluginContext {
|
|
|
return StoragePlugin.getUploadSign(uploadSign);
|
|
|
}
|
|
|
|
|
|
+ public void setFileAcl(String storagePluginName,String fileName,Boolean isPublic){
|
|
|
+ StoragePlugin storagePlugin = getStoragePlugin(storagePluginName);
|
|
|
+ storagePlugin.setFileAcl(fileName,isPublic);
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getPublicUrl(String fileName){
|
|
|
+ try {
|
|
|
+ String substring = fileName.substring(0, fileName.lastIndexOf("?"));
|
|
|
+ String substring1 = substring.substring(substring.lastIndexOf("/") + 1);
|
|
|
+ this.setFileAcl(KS3StoragePlugin.PLUGIN_NAME,substring1,true);
|
|
|
+ return substring;
|
|
|
+ }catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return fileName;
|
|
|
+ }
|
|
|
+
|
|
|
private StoragePlugin getStoragePlugin(String storagePluginName) {
|
|
|
StoragePlugin storagePlugin = mapper.get(storagePluginName);
|
|
|
|