You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the client encounters a malformed URL in a snap link, it throws an error. This recently caused a problem where the accidental inclusion of a javascript bookmarklet in a collection caused a front to fail to press.
java.net.URISyntaxException:Illegal character in opaque part at index 22: javascript:(function(){document.body.appendChild(document.createElement('script')).src='https://dashboard.ophan.co.uk/assets/js/heatmap-bookmarklet.js';})();
at java.net.URI$Parser.fail(URI.java:2847)
at java.net.URI$Parser.checkChars(URI.java:3020)
at java.net.URI$Parser.parse(URI.java:3057)
at java.net.URI.<init>(URI.java:588)
at com.gu.facia.api.contentapi.ContentApi$.toIdAndUri$1(ContentApi.scala:119)
at com.gu.facia.api.contentapi.ContentApi$.$anonfun$linkSnapBrandingsByEdition$5(ContentApi.scala:130)
at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:273)
at scala.collection.Iterator.foreach(Iterator.scala:943)
at scala.collection.Iterator.foreach$(Iterator.scala:943)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1431)
at scala.collection.IterableLike.foreach(IterableLike.scala:74)
at scala.collection.IterableLike.foreach$(IterableLike.scala:73)
at scala.collection.AbstractIterable.foreach(Iterable.scala:56)
at scala.collection.TraversableLike.map(TraversableLike.scala:273)
at scala.collection.TraversableLike.map$(TraversableLike.scala:266)
at scala.collection.AbstractTraversable.map(Traversable.scala:108)
at com.gu.facia.api.contentapi.ContentApi$.linkSnapBrandingsByEdition(ContentApi.scala:130)
at com.gu.facia.api.FAPI$.getLinkSnapBrandings(FAPI.scala:134)
at com.gu.facia.api.FAPI$.getLiveLinkSnapBrandingsForCollection(FAPI.scala:120)
at com.gu.facia.api.FAPI$.$anonfun$liveCollectionContentWithSnaps$2(FAPI.scala:159)
at com.gu.facia.api.Response.$anonfun$flatMap$1(Response.scala:13)
at scala.concurrent.Future.$anonfun$flatMap$1(Future.scala:307)
at scala.concurrent.impl.Promise.$anonfun$transformWith$1(Promise.scala:41)
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64)
at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:55)
at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:92)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:85)
at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:92)
at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:41)
at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:49)
at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
A solution
Proceeding on the assumption that it's better to trim invalid content and proceed with parsing the response than failing fast at this point in the pipeline, one solution would be to catch this error and drop the offending snap link from the collection instead.
If that assumption is correct, let's log a warning for visibility. We can make a corresponding change in the Fronts tool to make it harder (hopefully: impossible) for users to add invalid links.
The text was updated successfully, but these errors were encountered:
Problem
When the client encounters a malformed URL in a snap link, it throws an error. This recently caused a problem where the accidental inclusion of a javascript bookmarklet in a collection caused a front to fail to press.
A solution
Proceeding on the assumption that it's better to trim invalid content and proceed with parsing the response than failing fast at this point in the pipeline, one solution would be to catch this error and drop the offending snap link from the collection instead.
If that assumption is correct, let's log a warning for visibility. We can make a corresponding change in the Fronts tool to make it harder (hopefully: impossible) for users to add invalid links.
The text was updated successfully, but these errors were encountered: