diff --git a/apps/files_external/js/gdrive.js b/apps/files_external/js/gdrive.js index eb626e6ce127..333c906c992b 100644 --- a/apps/files_external/js/gdrive.js +++ b/apps/files_external/js/gdrive.js @@ -1,6 +1,6 @@ $(document).ready(function() { var backendId = 'googledrive'; - var backendUrl = OC.generateUrl('apps/files_external/ajax/oauth2.php'); + var backendUrl = OC.generateUrl('/index.php/apps/files_external/ajax/oauth2.php'); function generateUrl($tr) { // no mapping between client ID and Google 'project', so we always load the same URL diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js index 8447f2a6bc36..ba09beaffb81 100644 --- a/apps/files_sharing/js/public.js +++ b/apps/files_sharing/js/public.js @@ -228,7 +228,7 @@ OCA.Sharing.PublicApp = { urlSpec.x = Math.ceil(urlSpec.x); urlSpec.y = Math.ceil(urlSpec.y); urlSpec.t = $('#dirToken').val(); - return OC.generateUrl('/apps/files_sharing/ajax/publicpreview.php?') + $.param(urlSpec); + return OC.generateUrl('/index.php/apps/files_sharing/ajax/publicpreview.php') + '?' + $.param(urlSpec); }; this.fileList.updateEmptyContent = function () { diff --git a/apps/files_trashbin/js/filelist.js b/apps/files_trashbin/js/filelist.js index db0689766169..12ae829538c1 100644 --- a/apps/files_trashbin/js/filelist.js +++ b/apps/files_trashbin/js/filelist.js @@ -275,7 +275,7 @@ }, generatePreviewUrl: function(urlSpec) { - return OC.generateUrl('/apps/files_trashbin/ajax/preview.php?') + $.param(urlSpec); + return OC.generateUrl('/index.php/apps/files_trashbin/ajax/preview.php') + '?' + $.param(urlSpec); }, getDownloadUrl: function() { diff --git a/changelog/unreleased/41743 b/changelog/unreleased/41743 new file mode 100644 index 000000000000..9701163e5eb6 --- /dev/null +++ b/changelog/unreleased/41743 @@ -0,0 +1,18 @@ +Bugfix: Request legacy ajax endpoints through the front controller + +The front controller rewrite only forwards a request to index.php when the +requested path does not exist on disk. Five javascript call sites requested a url +that was itself a real file, so the web server executed the script directly, +without the bootstrap index.php would have performed, and the request died with a +fatal error (HTTP 500): changing the personal language, the share dialog e-mail +lookup, the Google Drive OAuth entry point, and the trashbin and public link +preview thumbnails. + +All five now build their url with an explicit /index.php/ prefix so that the +request no longer matches a file on disk and reaches the router. The prefix has +to be part of the url literal because OC.generateUrl() omits /index.php when +mod_rewrite is active, which is how four of the five came to request the shadowed +url in the first place. + +https://github.com/owncloud/core/issues/41740 +https://github.com/owncloud/core/pull/41743 diff --git a/core/js/sharedialogmailview.js b/core/js/sharedialogmailview.js index a47c867d07d1..d7fa155c9474 100644 --- a/core/js/sharedialogmailview.js +++ b/core/js/sharedialogmailview.js @@ -208,7 +208,7 @@ if (this.xhr != null) this.xhr.abort(); - var xhr = $.get(OC.generateUrl('core/ajax/share.php'), { + var xhr = $.get(OC.generateUrl('/index.php/core/ajax/share.php'), { 'fetch' : 'getShareWithEmail', 'search': query.term }).done(function(result) { diff --git a/settings/js/panels/profile.js b/settings/js/panels/profile.js index 6c181a3d5f87..22c9426f1103 100644 --- a/settings/js/panels/profile.js +++ b/settings/js/panels/profile.js @@ -213,7 +213,7 @@ $(document).ready(function () { // Serialize the data var post = $("#languageinput").serialize(); // Ajax foo - $.post('ajax/setlanguage.php', post, function (data) { + $.post(OC.generateUrl('/index.php/settings/ajax/setlanguage.php'), post, function (data) { if (data.status === "success") { location.reload(); }