diff options
author | Julius Härtl <jus@bitgrid.net> | 2021-07-13 08:47:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-13 08:47:43 +0200 |
commit | 49554c657da7da495209a260008da84b8b94ee1e (patch) | |
tree | c697bcbe60d54a3e7ccefc627da884fe8f9e4382 /core/js | |
parent | cabf24480e36204a63815bd717f7aa99ac438a99 (diff) | |
parent | 910c208c4c88f95a92d61fd658488f07f76fd0cd (diff) | |
download | nextcloud-server-49554c657da7da495209a260008da84b8b94ee1e.tar.gz nextcloud-server-49554c657da7da495209a260008da84b8b94ee1e.zip |
Merge pull request #26728 from doc75/http-warning
Diffstat (limited to 'core/js')
-rw-r--r-- | core/js/setupchecks.js | 2 | ||||
-rw-r--r-- | core/js/tests/specs/setupchecksSpec.js | 55 |
2 files changed, 56 insertions, 1 deletions
diff --git a/core/js/setupchecks.js b/core/js/setupchecks.js index 82d8b649af1..fc25f499020 100644 --- a/core/js/setupchecks.js +++ b/core/js/setupchecks.js @@ -487,7 +487,7 @@ type: OC.SetupChecks.MESSAGE_TYPE_WARNING }) } - if (window.location.protocol === 'http:' && data.reverseProxyGeneratedURL.split('/')[0] !== 'https:') { + if (window.location.protocol === 'https:' && data.reverseProxyGeneratedURL.split('/')[0] !== 'https:') { messages.push({ msg: t('core', 'You are accessing your instance over a secure connection, however your instance is generating insecure URLs. This most likely means that you are behind a reverse proxy and the overwrite config variables are not set correctly. Please read {linkstart}the documentation page about this ↗{linkend}.') .replace('{linkstart}', '<a target="_blank" rel="noreferrer noopener" class="external" href="' + data.reverseProxyDocs + '">') diff --git a/core/js/tests/specs/setupchecksSpec.js b/core/js/tests/specs/setupchecksSpec.js index a5e55a21209..79fdc12887e 100644 --- a/core/js/tests/specs/setupchecksSpec.js +++ b/core/js/tests/specs/setupchecksSpec.js @@ -990,6 +990,10 @@ describe('OC.SetupChecks tests', function() { }); }); + // THe following test is invalid as the code in core/js/setupchecks.js is calling + // window.location.protocol which always return http during tests + // if there is a way to trick window.location.protocol during test, then we could re-activate it + /* it('should return an error if the protocol is https but the server generates http links', function(done) { var async = OC.SetupChecks.checkSetup(); @@ -1043,6 +1047,57 @@ describe('OC.SetupChecks tests', function() { done(); }); }); + */ + it('should not return an error if the protocol is http and the server generates http links', function(done) { + var async = OC.SetupChecks.checkSetup(); + + suite.server.requests[0].respond( + 200, + { + 'Content-Type': 'application/json', + }, + JSON.stringify({ + hasFileinfoInstalled: true, + isGetenvServerWorking: true, + isReadOnlyConfig: false, + hasWorkingFileLocking: true, + hasValidTransactionIsolationLevel: true, + suggestedOverwriteCliURL: '', + isRandomnessSecure: true, + securityDocs: 'https://docs.nextcloud.com/myDocs.html', + serverHasInternetConnectionProblems: false, + isMemcacheConfigured: true, + forwardedForHeadersWorking: true, + isCorrectMemcachedPHPModuleInstalled: true, + hasPassedCodeIntegrityCheck: true, + isOpcacheProperlySetup: true, + hasOpcacheLoaded: true, + isSettimelimitAvailable: true, + hasFreeTypeSupport: true, + missingIndexes: [], + missingPrimaryKeys: [], + missingColumns: [], + cronErrors: [], + cronInfo: { + diffInSeconds: 0 + }, + isMemoryLimitSufficient: true, + appDirsWithDifferentOwner: [], + recommendedPHPModules: [], + pendingBigIntConversionColumns: [], + isMysqlUsedWithoutUTF8MB4: false, + isDefaultPhoneRegionSet: true, + isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, + reverseProxyDocs: 'https://docs.nextcloud.com/foo/bar.html', + reverseProxyGeneratedURL: 'http://server', + }) + ); + + async.done(function( data, s, x ){ + expect(data).toEqual([]); + done(); + }); + }); it('should return an error if there is not enough free space in the temp directory', function(done) { var async = OC.SetupChecks.checkSetup(); |