getattachment extensionless urls

Dennis Hulsmans asked on May 12, 2016 09:48

Hi

I'm having issues with a project, configured to use extensionless urls (as documented on K9 extensionless urls ).
It's only 1 project, other projects don't have this issue.
When I use "getfileurl" or "getimage" in a transformation I get urls like this:

<div class="image" style="background-image: url('/getattachment/43955191-ffd4-435b-b60a-a47864cdfe1b/')"></div>

Note the following: getattachment/guid/NO_FILENAME .

When I add an extension in the settings of this project it renders this: getattachment/guid/.aspx without the filename. I've tried everything, but I'm unable to pin point the cause of this issue.
Project has hotfix 14 (the other projects have the same update)

Any thoughts on this?

thx!

Correct Answer

Dennis Hulsmans answered on May 13, 2016 15:18

Found the solution: if you use the columns field to select some columns, you'll have to include NodeAlias too. NodeAlias is used by GetImage or GetFileUrl

see K9 documentation on loading data efficiently

1 votesVote for this answer Unmark Correct answer

Recent Answers


Chetan Sharma answered on May 12, 2016 10:34

Hi,

Is there any reason that you are using permanent urls. I don't prefer using it. I prefer not to have permanent links for my images and rather prefer to have their uploaded urls from the library which are something like /media/sitename/hellp.png

And I also keep "Friendly URL extensions" & "Files friendly URL extension" empty.

I have attached two screens shots. give it a try.

http://postimg.org/image/y14uhegjl/

http://postimg.org/image/etyphncxt/

Thanks, Chetan

0 votesVote for this answer Mark as a Correct answer

Dennis Hulsmans answered on May 12, 2016 10:55

Hi Chetan,

Thanks for the quick reply.

I'm not using permanent urls. My settings are the same as yours (in the screenshot).
I'm not sure what's causing this in this project.

1 votesVote for this answer Mark as a Correct answer

Jan Hermann answered on May 12, 2016 12:51

Please check you don't force trailing slash in your urls (Settings -> URLs and SEO) since there was bug in your hotfix.

Also, I recommend to build the url manually due to performance. You wouldn't call another method like GetFileUrl and the file name isn't mandatory:

~/getattachment/{%FileFieldThatREturnsAttachmentGUID%}/file(.aspx) or ~/getattachment/{%FileFieldThatREturnsAttachmentGUID%}/{%DocumentName%}(.aspx)

or its ASCX version.

3 votesVote for this answer Mark as a Correct answer

Chetan Sharma answered on May 12, 2016 14:19

Thanks Jan, that was spot on. I missed that point.

0 votesVote for this answer Mark as a Correct answer

Laura Frese answered on May 12, 2016 18:34

You might also try

/CMSPages/GetFile.aspx?guid=<% Eval("MyImage")%>

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.