Fix share link routing: add initialLocation to GoRouter and fix download URL host
This commit is contained in:
@@ -16,7 +16,11 @@ import 'pages/public_file_viewer.dart';
|
|||||||
import 'theme/app_theme.dart';
|
import 'theme/app_theme.dart';
|
||||||
import 'injection.dart';
|
import 'injection.dart';
|
||||||
|
|
||||||
|
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||||
|
import 'package:web/web.dart' as web;
|
||||||
|
|
||||||
final GoRouter _router = GoRouter(
|
final GoRouter _router = GoRouter(
|
||||||
|
initialLocation: kIsWeb ? web.window.location.pathname + web.window.location.search : '/',
|
||||||
routes: [
|
routes: [
|
||||||
GoRoute(path: '/', builder: (context, state) => const HomePage()),
|
GoRoute(path: '/', builder: (context, state) => const HomePage()),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
|
|||||||
@@ -2922,10 +2922,7 @@ func publicFileShareHandler(w http.ResponseWriter, r *http.Request, db *database
|
|||||||
} else if r.TLS == nil {
|
} else if r.TLS == nil {
|
||||||
scheme = "http"
|
scheme = "http"
|
||||||
}
|
}
|
||||||
host := r.Host
|
host := "www.b0esche.cloud"
|
||||||
if host == "" {
|
|
||||||
host = "go.b0esche.cloud"
|
|
||||||
}
|
|
||||||
downloadPath := fmt.Sprintf("%s://%s/public/share/%s/download?token=%s", scheme, host, token, url.QueryEscape(viewerToken))
|
downloadPath := fmt.Sprintf("%s://%s/public/share/%s/download?token=%s", scheme, host, token, url.QueryEscape(viewerToken))
|
||||||
|
|
||||||
// Determine file type
|
// Determine file type
|
||||||
|
|||||||
Reference in New Issue
Block a user