Skip to content

Commit d4e95cf

Browse files
authored
DM-51807: Replace dashes with underscores in usernames used for uploads (#162)
1 parent d8a28fe commit d4e95cf

File tree

5 files changed

+17
-4
lines changed

5 files changed

+17
-4
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ Find changes for the upcoming release in the project's [changelog.d](https://git
66

77
<!-- scriv-insert-here -->
88

9+
<a id='changelog-3.4.3'></a>
10+
## 3.4.3 (2025-07-15)
11+
12+
### Changed
13+
14+
- Change dashes to underscores in user database name for uploaded tables
15+
916
<a id='changelog-3.4.2'></a>
1017
## 3.4.2 (2025-07-10)
1118

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ dependencies {
4848
}
4949

5050
implementation 'org.opencadc:cadc-access-control-identity:[1.0.7,)'
51-
implementation 'org.opencadc:cadc-adql:[1.1.16,)'
51+
implementation 'org.opencadc:cadc-adql:1.1.15'
5252
implementation 'org.opencadc:cadc-dali-pg:0.3.1'
5353
implementation 'org.opencadc:cadc-dali:[1.2.24,)'
5454
implementation 'org.opencadc:cadc-log:[1.2.1,)'

src/main/java/org/opencadc/tap/impl/RubinUploadManagerImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,9 @@ public String getDatabaseTableName(UploadTable uploadTable) {
405405
StringBuilder sb = new StringBuilder();
406406
String username = getUsername();
407407
if (username != null) {
408-
sb.append("user_").append(username).append(".");
408+
// Replace dashes with underscores
409+
String sanitizedUsername = username.replace("-", "_");
410+
sb.append("user_").append(sanitizedUsername).append(".");
409411
}
410412
sb.append(uploadTable.tableName);
411413
sb.append("_");

src/main/java/org/opencadc/tap/kafka/util/KafkaJobService.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,11 @@ public static boolean prepareAndSubmitJob(Job job,
9595
// Temp fix
9696
// If there is a table upload, use the username as the database
9797
if (!jobInfo.uploadTables.isEmpty()){
98-
databaseString = "user_" + getUsername();
98+
String username = getUsername();
99+
if (username == null || username.isEmpty()) {
100+
username = "anonymous";
101+
}
102+
databaseString = "user_" + getUsername().replace("-", "_");
99103
}
100104

101105
// Submit job to Kafka

src/main/java/org/opencadc/tap/kafka/util/VOTableUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,4 +258,4 @@ public static String generateErrorVOTable(String errorMessage) {
258258
+ "</RESOURCE>"
259259
+ "</VOTABLE>";
260260
}
261-
}
261+
}

0 commit comments

Comments
 (0)