-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Time placeholder of upload path (#74)
Fixes #69 ```release-note 文件上传路径支持使用`${year}`,`${month}`,`${day}`占位符 ```
- Loading branch information
1 parent
38f2018
commit 217f1db
Showing
4 changed files
with
32 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package run.halo.s3os; | ||
|
||
import org.apache.commons.lang3.StringUtils; | ||
|
||
import java.time.LocalDate; | ||
|
||
public class FilePathUtils { | ||
private FilePathUtils() { | ||
|
||
} | ||
|
||
public static String getFilePathByPlaceholder(String filename) { | ||
LocalDate localDate = LocalDate.now(); | ||
return StringUtils.replaceEach(filename, | ||
new String[] {"${year}","${month}","${day}"}, | ||
new String[] { | ||
String.valueOf(localDate.getYear()), | ||
String.valueOf(localDate.getMonthValue()), | ||
String.valueOf(localDate.getDayOfMonth()) | ||
} | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters