Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetching a URL that redirects has the first page content prepended #1476

Open
akirk opened this issue May 31, 2024 · 1 comment
Open

Fetching a URL that redirects has the first page content prepended #1476

akirk opened this issue May 31, 2024 · 1 comment
Labels
[Status] Awaits reporter response [Type] Bug An existing feature does not function as intended

Comments

@akirk
Copy link
Member

akirk commented May 31, 2024

I ran into this with Translate Live:

const fetchTranslations = function() {
	const url = '/glotpress/projects/' + localProjectPath + '/' + lang + '/' + translation_set_slug + '/export-translations?format=po&filters[user_login]=admin';
	playground.request( { url } ).then( function( po ) {
		const po_content = new TextDecoder().decode( po.bytes );
	} );
};

That URL is being redirected (which I might be able to get rid of) and it reveals non-standard behavior because the text of the redirecting page is prepended to the content:

Umleitung nach: /scope:0.3732595394027483/glotpress/projects/local-plugins/friends/de/default/export-translations/?format=po&filters[user_login]=admin …# Translation of Plugins - friends in German
# This file is distributed under the same license as the Plugins - friends package.

The part before the first # is from the redirection template and should not be part of the response.

I was able to workaround this with a regex replace (.replace( /^[^#]+/, '' )) but I believe this should be changed.

@adamziel adamziel added the [Type] Bug An existing feature does not function as intended label Jun 28, 2024
@adamziel
Copy link
Collaborator

Is this a Playground bug or WordPress bug?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] Awaits reporter response [Type] Bug An existing feature does not function as intended
2 participants