File tree Expand file tree Collapse file tree
main/java/com/arcadedb/integration/backup
test/java/com/arcadedb/integration/backup Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,6 +46,10 @@ public void validateSettings() {
4646 if (format == null )
4747 throw new IllegalArgumentException ("Missing backup format" );
4848
49+ if (file != null && (file .startsWith ("http://" ) || file .startsWith ("https://" ) || file .startsWith ("classpath://" )))
50+ throw new IllegalArgumentException (
51+ "Backup to remote URLs is not supported. Only local file paths and 'file://' URLs are allowed" );
52+
4953 if (directory != null && file != null ) {
5054 final String f = file .startsWith ("file://" ) ? file .substring ("file://" .length ()) : file ;
5155 if (f .contains (".." ) || f .contains (File .separator ))
Original file line number Diff line number Diff line change 2828import java .nio .file .Path ;
2929
3030import static org .assertj .core .api .Assertions .assertThat ;
31+ import static org .assertj .core .api .Assertions .assertThatThrownBy ;
3132
3233class BackupDatabaseTest extends TestHelper {
3334
@@ -45,6 +46,22 @@ void backup() {
4546 assertThat (result .<String >getProperty ("backupFile" )).isEqualTo ("file://test-backup.zip" );
4647 }
4748
49+ @ Test
50+ void backupWithHttpUrlShouldFail () {
51+ assertThatThrownBy (() -> database .command ("sql" , "backup database http://example.com/backup.zip" ))
52+ .rootCause ()
53+ .isInstanceOf (IllegalArgumentException .class )
54+ .hasMessageContaining ("not supported" );
55+ }
56+
57+ @ Test
58+ void backupWithHttpsUrlShouldFail () {
59+ assertThatThrownBy (() -> database .command ("sql" , "backup database https://example.com/backup.zip" ))
60+ .rootCause ()
61+ .isInstanceOf (IllegalArgumentException .class )
62+ .hasMessageContaining ("not supported" );
63+ }
64+
4865 @ Test
4966 void backupEncryption () {
5067 ResultSet resultSet = database .command ("sql" , "backup database file://test-backup.zip with encryptionKey = 'SuperSecretKey'" );
You can’t perform that action at this time.
0 commit comments