readium / readium-sdk

A C++ ePub renderer SDK
BSD 3-Clause "New" or "Revised" License
383 stars 164 forks source link

"refines" OPF metadata fails when includes not only fragment, but also filepath #138

Open danielweck opened 9 years ago

danielweck commented 9 years ago

Test EPUB: https://code.google.com/p/epub-samples/downloads/detail?name=widget-figure-gallery-20121022.epub

OPF:

<link rel="cc:attributionURL" refines="text.xhtml#moon-text" href="http://en.wikipedia.org/wiki/Lunar_phase" />

<link rel="cc:attributionURL" refines="text.xhtml#moon-figures" href="http://www.flickr.com/photos/gsfc/sets/72157626962784062/"/>

<link rel="cc:attributionURL" refines="text.xhtml#moon-figures" href="http://www.flickr.com/photos/gsfc/sets/72157626962784062/"/>

Resulting error with SDKLauncher-OSX:

#text.xhtml#moon-text is not a valid IRI: Unspecified EPUB specification error
#text.xhtml#moon-figures is not a valid IRI: Unspecified EPUB specification error
#text.xhtml#moon-figures is not a valid IRI: Unspecified EPUB specification error
danielweck commented 9 years ago

This looks intentional: https://github.com/readium/readium-sdk/blob/develop/ePub3/ePub/package.cpp#L801

// validation only right now
                IRI iri(ident);
                if ( iri.IsEmpty() )
                {
                    HandleError(EPUBError::OPFInvalidRefinementAttribute, _Str("#", ident, " is not a valid IRI"));
                }
                else if ( iri.IsRelative() == false )
                {
                    HandleError(EPUBError::OPFInvalidRefinementAttribute, _Str(iri.IRIString(), " is not a relative IRI"));
                }
                continue;