We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2f188aa commit 20c3d6dCopy full SHA for 20c3d6d
1 file changed
src/daemon/config.js
@@ -183,7 +183,15 @@ function migrateConfig (ipfsd) {
183
if (CURRENT_REVISION < 3) {
184
const api = config.API || {}
185
const httpHeaders = api.HTTPHeaders || {}
186
- const accessControlAllowOrigin = httpHeaders['Access-Control-Allow-Origin'] || []
+ let accessControlAllowOrigin = httpHeaders['Access-Control-Allow-Origin'] || []
187
+
188
+ // Ensure accessControlAllowOrigin is an array
189
+ if (!Array.isArray(accessControlAllowOrigin)) {
190
+ // Convert string to array, or create empty array for other types
191
+ accessControlAllowOrigin = typeof accessControlAllowOrigin === 'string'
192
+ ? [accessControlAllowOrigin]
193
+ : []
194
+ }
195
196
const addURL = url => {
197
if (!accessControlAllowOrigin.includes(url)) {
0 commit comments