Git Product home page Git Product logo

Comments (4)

jhorsman avatar jhorsman commented on June 19, 2024

I could reproduce this issue in DXA JAVA 1.2.1 too.
See RWS/dxa-web-application-java#32

from dxa-web-application-dotnet.

jordanrobinson avatar jordanrobinson commented on June 19, 2024

Hey guys,

I've been trying to debug this a little since we've come across it while developing with the DXA release 1.3. (As far as I can tell the issue should also happen in 1.4).

I've traced this through to the BinaryFileManager class on line 102 of the DXA solution, from here this calls
DateTime lpb = binaryFactory.FindLastPublishedDate(urlPath);

At this point however urlPath has already been encoded (which is a good thing) but between here and what hits the database, the urlPath seems to get unencoded somehow. What this means is that while what is passed into that method is /images/tree%20mid_tcm13-3219.jpg the actual query that hits the db comes out as

declare @p1 int
set @p1=1
exec sp_prepexec @p1 output,N'@P0 int,@P1 nvarchar(4000)',N'select binaryvari0_.BINARY_ID as BINARY_I1_0_, binaryvari0_.PUBLICATION_ID as PUBLICAT2_0_, binaryvari0_.VARIANT_ID as VARIANT_3_0_, binaryvari0_.TYPE as TYPE4_0_, binaryvari0_.IS_COMPONENT as IS_COMPO5_0_, binaryvari0_.DESCRIPTION as DESCRIPT6_0_, binaryvari0_.PATH as PATH7_0_, binaryvari0_.URL as URL8_0_ from BINARYVARIANTS binaryvari0_ where binaryvari0_.PUBLICATION_ID=@P0 
and lower(binaryvari0_.URL)=@P1                ',13,N'/images/tree mid_tcm13-3219.jpg'
select @p1

Where you'll notice the path has been unencoded back to having a space in. This then of course fails, since the path in the database is encoded and it can't find a path that isn't encoded.

So to go back to the initial DXA code, it calls off to the SDLWeb8 DD4T provider, which I believe is the one found here: https://github.com/dd4t/DD4T.Providers.SDLWeb8.CIL

The relevant calls come from the GetBinaryByUrl method in the TridionBinaryProvider, which tries to encode the url again. While this is unnecessary, it isn't the cause of the issue, as the url and the encoded url are at this point the same. (Shown here)

2016-05-19 10_36_20-dd4t providers sdlweb8 cil debugging - microsoft visual studio administrator

The issue as far as I can see is that after this the url is passed to the tridion BinaryMetaFactory (Tridion.ContentDelivery.Meta.BinaryMetaFactory) which seems to unencode the string back into containing spaces before it hits the database and results in the query above.

Any questions on this please let me know.

Thanks,
Jordan

from dxa-web-application-dotnet.

rpannekoek avatar rpannekoek commented on June 19, 2024

Thanks for your analysis; this is very useful input! Indeed, the problem seems to be in SDL Web 8 CIL/CIS rather than in DXA/DD4T code base. It might be possible to work-around with double encoding, but that would be creating a bug to fix another bug.

from dxa-web-application-dotnet.

rpannekoek avatar rpannekoek commented on June 19, 2024

Fixed in DXA 1.5 / CIL 8.2

from dxa-web-application-dotnet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.