File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -287,15 +287,14 @@ func (r Request) getDatabase(ctx context.Context, db database.Store) (*databaseR
287
287
// whether the app is a slug or a port and whether there are multiple agents
288
288
// in the workspace or not.
289
289
var (
290
- agentNameOrID = r .AgentNameOrID
291
- appURL string
292
- appSharingLevel database.AppSharingLevel
290
+ agentNameOrID = r .AgentNameOrID
291
+ appURL string
292
+ appSharingLevel database.AppSharingLevel
293
+ // First check if it's a port-based URL with an optional "s" suffix for HTTPS.
293
294
potentialPortStr = strings .TrimSuffix (r .AppSlugOrPort , "s" )
294
295
portUint , portUintErr = strconv .ParseUint (potentialPortStr , 10 , 16 )
295
296
)
296
297
if portUintErr == nil {
297
- // If we fail to parse the port, see if it's a port with a trailing "s" for
298
- // HTTPS.
299
298
protocol := "http"
300
299
if strings .HasSuffix (r .AppSlugOrPort , "s" ) {
301
300
protocol = "https"
@@ -350,6 +349,10 @@ func (r Request) getDatabase(ctx context.Context, db database.Store) (*databaseR
350
349
}
351
350
// No port share found, so we keep default to owner.
352
351
} else {
352
+ if ps .Protocol == database .PortShareProtocolHttps {
353
+ // Apply HTTPS protocol if specified.
354
+ appURL = fmt .Sprintf ("https://127.0.0.1:%d" , portUint )
355
+ }
353
356
appSharingLevel = ps .ShareLevel
354
357
}
355
358
} else {
You can’t perform that action at this time.
0 commit comments