mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-08-14 23:51:41 +00:00
Handle S3 disabled better.
This commit is contained in:
parent
b7d4187ff3
commit
705a52cb7d
2 changed files with 11 additions and 0 deletions
|
@ -174,6 +174,7 @@ public class Constants {
|
|||
YOUTUBE_SERVICE.getSupportedCountries().stream().map(ContentCountry::getCountryCode)
|
||||
.map(JsonNodeFactory.instance::textNode).toList()
|
||||
);
|
||||
frontendProperties.put("s3Enabled", S3_CLIENT != null);
|
||||
|
||||
// transform hibernate properties for legacy configurations
|
||||
hibernateProperties.replace("hibernate.dialect",
|
||||
|
|
|
@ -21,6 +21,9 @@ public class StorageHandlers {
|
|||
|
||||
public static byte[] statFile(String session, String name) throws Exception {
|
||||
|
||||
if (Constants.S3_CLIENT == null)
|
||||
ExceptionHandler.throwErrorResponse(new SimpleErrorMessage("Storage is not configured on this instance!"));
|
||||
|
||||
if (!StringUtils.isAlphanumeric(name) || name.length() > 32)
|
||||
ExceptionHandler.throwErrorResponse(new SimpleErrorMessage("Invalid path provided!"));
|
||||
|
||||
|
@ -56,6 +59,9 @@ public class StorageHandlers {
|
|||
|
||||
public static byte[] putFile(String session, String name, String etag, byte[] content) throws Exception {
|
||||
|
||||
if (Constants.S3_CLIENT == null)
|
||||
ExceptionHandler.throwErrorResponse(new SimpleErrorMessage("Storage is not configured on this instance!"));
|
||||
|
||||
if (!StringUtils.isAlphanumeric(name) || name.length() > 32)
|
||||
ExceptionHandler.throwErrorResponse(new SimpleErrorMessage("Invalid path provided!"));
|
||||
|
||||
|
@ -102,6 +108,10 @@ public class StorageHandlers {
|
|||
}
|
||||
|
||||
public static byte[] getFile(String session, String name) throws Exception {
|
||||
|
||||
if (Constants.S3_CLIENT == null)
|
||||
ExceptionHandler.throwErrorResponse(new SimpleErrorMessage("Storage is not configured on this instance!"));
|
||||
|
||||
if (!StringUtils.isAlphanumeric(name) || name.length() > 32)
|
||||
ExceptionHandler.throwErrorResponse(new SimpleErrorMessage("Invalid path provided!"));
|
||||
|
||||
|
|
Loading…
Reference in a new issue