Created
June 7, 2012 18:47
-
-
Save mhulse/2890726 to your computer and use it in GitHub Desktop.
Caché DTI ContentPublisher: Tested in 7.6: Example code to fix image paths using ..UnescapeHTML() and ..EscapeURL().
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script language="cache" method="OnPreHTTP" arguments="" returntype="%Boolean"> | |
do %response.SetHeader("Content-Type", "text/plain") | |
quit 1 // Exit. | |
</script> | |
<csp:object name="gStory" classname="dt.cms.schema.CMSStory" objid="28188418"> | |
#[ new path set path = ##class(csp.web.assets.methods.image).imageUri("990pxw", gStory) ]# | |
Straight out of the box: | |
http://www.registerguard.com#(path)# | |
Notice that the image URI above just downloads if you copy/paste the URI into | |
your browser (well, I only tested in Firefox 12/Mac). | |
I think that the & is causing the CONTENTTYPE to not get passed to the | |
StreamServer class; from what I can tell, "downloading" is the default | |
functionality for the StreamServer class if it's an image without a CONTENTTYPE | |
querystring parameter. | |
---------- | |
Using ..UnescapeHTML(): | |
http://www.registerguard.com#(..UnescapeHTML(path))# | |
The URI above will display in the browser if copy/pasted (using Firefox 12/Mac). | |
---------- | |
Using ..UnescapeHTML() and ..EscapeURL(): | |
http://www.registerguard.com#(..EscapeURL(..UnescapeHTML(path)))# | |
Not sure if you will need it (from my tests, it's not needed), but sometimes URL | |
encoding the URI/querystring (above) can help in certain situations (for | |
example, if you need to put URL into another URI's querystirng). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment