mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2025-04-29 08:20:30 +05:30
Handle S3 disabled better.
This commit is contained in:
parent
b7d4187ff3
commit
705a52cb7d
@ -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…
x
Reference in New Issue
Block a user