Skip to content

Commit 1160375

Browse files
authored
Merge pull request #17616 from iterate-ch/feature/DEEP-35-copyurl
Add special mapping for production.
2 parents 3ca79dc + 4459e85 commit 1160375

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

deepbox/src/main/java/ch/cyberduck/core/deepbox/DeepboxSession.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,9 @@ public <T> T _getFeature(final Class<T> type) {
239239

240240
public String getStage() {
241241
// For now, required for descriptive URL, API forthcoming
242-
// api.[<stage>.]deepbox.swiss
242+
// api.[<stage>.]deepbox.swiss, defaults to app if no stage is specified
243243
String hostname = this.getHost().getHostname();
244-
return hostname.replaceAll("^api\\.", "").replaceAll("deepbox\\.swiss$", "");
244+
final String stage = hostname.replaceAll("^api\\.", "").replaceAll("deepbox\\.swiss$", "");
245+
return StringUtils.isBlank(stage) ? "app." : stage;
245246
}
246247
}

deepbox/src/test/java/ch/cyberduck/core/deepbox/DeepboxSessionTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@
2727

2828
public class DeepboxSessionTest {
2929

30-
private static Stream<Arguments> provideStringsForIsBlank() {
30+
private static Stream<Arguments> provideStringsForGetStage() {
3131
return Stream.of(
3232
Arguments.of("api.int.deepbox.swiss", "int."),
33-
Arguments.of("api.deepbox.swiss", "")
33+
Arguments.of("api.deepbox.swiss", "app.")
3434
);
3535
}
3636

3737
@ParameterizedTest
38-
@MethodSource("provideStringsForIsBlank")
38+
@MethodSource("provideStringsForGetStage")
3939
public void getStage(final String hostname, final String expectedStage) {
4040
final DeepboxSession session = new DeepboxSession(new Host(new DeepboxProtocol(), hostname), null, null);
4141
assertEquals(expectedStage, session.getStage());

0 commit comments

Comments
 (0)