amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

amp-list: __amp_source_origin added when using string interpolation

Open jessanastasio opened this issue 9 years ago • 4 comments

What's the issue?

Using {{ someValue }} string interpolation feature for an amp-list src URL inadvertently adds __amp_source_origin, causing Source origin is not allowed in (src URL)

How do we reproduce the issue?

When building a dynamic amp-list using amp-bind just like this example https://ampbyexample.com/samples_templates/product_page/#dynamic-related-product-lists -- if you set your new [src] value as a string interpolation from your API response AMP inadvertently adds __amp_source_origin, causing Source origin is not allowed in (src URL)

Example

using string interpolated next value from the API response to point to the next page of results it appends the &__amp_source_origin= and doesnt work

<button [disabled]="listSrcButtonDisabled"
      class="ampstart-btn caps m1 mb3"
      id="listSrcButton"
      on="tap:AMP.setState({recipes: {recentRecipesSrc: 'https://my-api-origin.com/{{ next }}'}})">Show more</button>

but hardcoding a value recentRecipesSrc works and doesn't append &__amp_source_origin=

<button [disabled]="listSrcButtonDisabled"
      class="ampstart-btn caps m1 mb3"
      id="listSrcButton"
      on="tap:AMP.setState({recipes: {recentRecipesSrc: 'https://my-api-origin.com/hardcoded-full-path-next-page'}})">Show more</button>

What browsers are affected?

All browsers

Which AMP version is affected?

Version 1504040004635

jessanastasio avatar Sep 07 '17 21:09 jessanastasio

CC @choumx

jessanastasio avatar Sep 07 '17 21:09 jessanastasio

This issue hasn't been updated in awhile. @choumx Do you have any updates?

ampprojectbot avatar Dec 18 '17 21:12 ampprojectbot

This issue hasn't been updated in awhile. @choumx Do you have any updates?

ampprojectbot avatar Jun 05 '18 12:06 ampprojectbot

I tried this again and couldn't reproduce the bug. I suspect the {{next}} data contained ?__amp_source_origin=....

dreamofabear avatar Aug 06 '19 22:08 dreamofabear