← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/bug1073091 into lp:zorba

 

Juan Zacarias has proposed merging lp:~zorba-coders/zorba/bug1073091 into lp:zorba.

Commit message:
The function fn:unparsed-text-available now return false for fragment identifiers
The functions fn:unparsed-text and fn:unparsed-text-lines now throw an error when trying to load a fragment identifier

Requested reviews:
  Chris Hillery (ceejatec)
  Sorin Marian Nasoi (sorin.marian.nasoi)
Related bugs:
  Bug #1073091 in Zorba: "FOTS: fn:unparsed-text-lines bug"
  https://bugs.launchpad.net/zorba/+bug/1073091

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug1073091/+merge/139346
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug1073091/+merge/139346
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/runtime/sequences/sequences_impl.cpp'
--- src/runtime/sequences/sequences_impl.cpp	2012-10-16 14:30:02 +0000
+++ src/runtime/sequences/sequences_impl.cpp	2012-12-11 23:52:21 +0000
@@ -1905,9 +1905,22 @@
   store::Item_t& oResult)
 {
   //Normalize input to handle filesystem paths, etc.
-  zstring lNormUri;
+  zstring lNormUri;  
+  size_t found = 0;
+
   normalizeInputUri(aUri, aSctx, loc, &lNormUri);
 
+  //check if fragment identifier
+  found = lNormUri.find_last_of("#");
+  if (found != lNormUri.npos)
+  {
+    //confirm if fragment
+    if (lNormUri.at(found-1) == '/')
+    {
+      throw XQUERY_EXCEPTION(err::FOUT1170, ERROR_PARAMS(aUri), ERROR_LOC(loc));    
+    } 
+  }
+
   //Resolve URI to stream
   zstring lErrorMessage;
   std::auto_ptr<internal::Resource> lResource = aSctx->resolve_uri
@@ -2040,6 +2053,7 @@
   zstring lErrorMessage;
   std::auto_ptr<internal::Resource> lResource;
   StreamReleaser lStreamReleaser;
+  size_t found = 0;
 
   FnUnparsedTextLinesIteratorState* state;
   DEFAULT_STACK_INIT(FnUnparsedTextLinesIteratorState, state, planState);
@@ -2059,6 +2073,17 @@
   uriItem->getStringValue2(uriString);
   normalizeInputUri(uriString, theSctx, loc, &lNormUri);
 
+  //check if fragment identifier
+  found = lNormUri.find_last_of("#");
+  if (found != lNormUri.npos)
+  {
+    //confirm if fragment
+    if (lNormUri.at(found-1) == '/')
+    {
+      throw XQUERY_EXCEPTION(err::FOUT1170, ERROR_PARAMS(uriString), ERROR_LOC(loc));    
+    } 
+  }
+
   //Resolve URI to stream
   lResource = theSctx->resolve_uri
     (lNormUri, internal::EntityData::SOME_CONTENT, lErrorMessage);


Follow ups