mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
Merge pull request #1704 from PR0M3TH3AN/codex/ensure-cloudflaresettings-initialization
Guard R2 settings bucket lookup when config is missing
This commit is contained in:
1 file changed
+6
-2
@@ -611,7 +611,11 @@ class R2Service {
|
||||
// If using StorageService (settings.isLegacy === false), we do NOT save to legacy store
|
||||
// to avoid partial state or overwriting. We just return the manual entry.
|
||||
if (settings.isLegacy !== false) {
|
||||
let entry = this.cloudflareSettings.buckets?.[npub];
|
||||
const currentSettings = this.getSettings();
|
||||
if (!this.cloudflareSettings) {
|
||||
this.cloudflareSettings = currentSettings;
|
||||
}
|
||||
let entry = currentSettings.buckets?.[npub];
|
||||
let savedEntry = entry;
|
||||
|
||||
if (
|
||||
@@ -620,7 +624,7 @@ class R2Service {
|
||||
entry.publicBaseUrl !== manualEntry.publicBaseUrl
|
||||
) {
|
||||
const updatedSettings = await saveR2Settings(
|
||||
mergeBucketEntry(this.getSettings(), npub, manualEntry)
|
||||
mergeBucketEntry(currentSettings, npub, manualEntry)
|
||||
);
|
||||
this.setSettings(updatedSettings);
|
||||
savedEntry = updatedSettings.buckets?.[npub] || manualEntry;
|
||||
|
||||
Reference in new issue
Block a user