msiemens / onenote.rs Goto Github PK
View Code? Open in Web Editor NEWA Rust OneNote file parser
License: Mozilla Public License 2.0
A Rust OneNote file parser
License: Mozilla Public License 2.0
error[E0308]: mismatched types
--> /Users/myusername/.cargo/registry/src/github.com-1ecc6299db9ec823/one2html-1.1.1/src/utils.rs:12:41
|
12 | let _state = happylog::set_progress(&bar);
| ---------------------- ^^^^ expected struct `indicatif::progress_bar::ProgressBar`, found struct `ProgressBar`
| |
| arguments to this function are incorrect
|
= note: struct `ProgressBar` and struct `indicatif::progress_bar::ProgressBar` have similar names, but are actually distinct types
note: struct `ProgressBar` is defined in crate `indicatif`
--> /Users/myusername/.cargo/registry/src/github.com-1ecc6299db9ec823/indicatif-0.16.2/src/progress_bar.rs:23:1
|
23 | pub struct ProgressBar {
| ^^^^^^^^^^^^^^^^^^^^^^
note: struct `indicatif::progress_bar::ProgressBar` is defined in crate `indicatif`
--> /Users/myusername/.cargo/registry/src/github.com-1ecc6299db9ec823/indicatif-0.17.3/src/progress_bar.rs:21:1
|
21 | pub struct ProgressBar {
| ^^^^^^^^^^^^^^^^^^^^^^
= note: perhaps two different versions of crate `indicatif` are being used?
note: function defined here
--> /Users/myusername/.cargo/registry/src/github.com-1ecc6299db9ec823/happylog-0.2.0/src/console_emitter.rs:93:8
|
93 | pub fn set_progress(pb: &ProgressBar) -> LogPBState {
| ^^^^^^^^^^^^
For more information about this error, try `rustc --explain E0308`.
โฏ cargo install --no-default-features one2html Updating crates.io index Installing one2html v1.1.1 Compiling proc-macro2 v1.0.50 Compiling quote v1.0.23 Compiling unicode-ident v1.0.6 Compiling syn v1.0.107 Compiling version_check v0.9.4 Compiling libc v0.2.139 Compiling autocfg v1.1.0 Compiling cfg-if v1.0.0 Compiling memchr v2.3.4 Compiling lazy_static v1.4.0 Compiling num-traits v0.2.15 Compiling radium v0.5.3 Compiling getrandom v0.1.16 Compiling serde v1.0.152 Compiling serde_derive v1.0.152 Compiling lexical-core v0.7.6 Compiling nom v6.2.1 Compiling once_cell v1.17.0 Compiling unicode-width v0.1.10 Compiling unicase v2.6.0 Compiling ppv-lite86 v0.2.17 Compiling bitflags v1.3.2 Compiling rand_core v0.5.1 Compiling proc-macro-error-attr v1.0.4 Compiling siphasher v0.3.10 Compiling rand_pcg v0.2.1 Compiling rand_chacha v0.2.2 Compiling phf_shared v0.8.0 Compiling tracing-core v0.1.30 Compiling rand v0.7.3 Compiling proc-macro-error v1.0.4 Compiling arrayvec v0.5.2 Compiling funty v1.1.0 Compiling static_assertions v1.1.0 Compiling wyz v0.2.0 Compiling tap v1.0.1 Compiling ryu v1.0.12 Compiling bitvec v0.19.6 Compiling tracing-attributes v0.1.23 Compiling phf_generator v0.8.0 Compiling thread_local v1.1.4 Compiling aho-corasick v0.7.15 Compiling sharded-slab v0.1.4 Compiling miniz_oxide v0.4.4 Compiling regex-syntax v0.6.28 Compiling pin-project-lite v0.2.9 Compiling cc v1.0.78 Compiling unicode-segmentation v1.10.0 Compiling portable-atomic v0.3.19 Compiling backtrace v0.3.59 Compiling regex v1.4.6 Compiling heck v0.3.3 Compiling tracing-subscriber v0.2.25 Compiling phf_codegen v0.8.0 Compiling textwrap v0.11.0 Compiling console v0.15.5 Compiling atty v0.2.14 Compiling strsim v0.8.0 Compiling encoding_rs v0.8.31 Compiling gimli v0.24.0 Compiling log v0.4.17 Compiling paste v1.0.11 Compiling tracing v0.1.37 Compiling adler v1.0.2 Compiling number_prefix v0.4.0 Compiling percent-encoding v2.2.0 Compiling thiserror v1.0.38 Compiling humansize v1.1.1 Compiling eyre v0.6.8 Compiling ansi_term v0.12.1 Compiling askama_escape v0.10.3 Compiling vec_map v0.8.2 Compiling addr2line v0.15.2 Compiling clap v2.34.0 Compiling tracing-error v0.1.2 Compiling structopt-derive v0.4.18 Compiling palette v0.5.0 Compiling mime_guess v2.0.4 Compiling thiserror-impl v1.0.38 Compiling rustc-demangle v0.1.21 Compiling either v1.8.0 Compiling object v0.24.0 Compiling indenter v0.3.3 Compiling owo-colors v1.3.0 Compiling color-spantrace v0.1.6 Compiling itertools v0.9.0 Compiling indicatif v0.17.3 Compiling phf v0.8.0 Compiling approx v0.3.2 Compiling enum-primitive-derive v0.2.2 Compiling palette_derive v0.5.0 Compiling terminal_size v0.1.17 Compiling structopt v0.3.26 Compiling widestring v0.4.3 Compiling mime v0.3.16 Compiling uuid v0.8.2 Compiling bytes v0.5.6 Compiling happylog v0.2.0 Compiling console v0.14.1 Compiling color-eyre v0.5.11 Compiling indicatif v0.16.2 Compiling sanitize-filename v0.3.0 Compiling onenote_parser v0.3.1 Compiling toml v0.5.11 Compiling askama_shared v0.11.2 Compiling askama_derive v0.10.5 Compiling askama v0.10.5 Compiling one2html v1.1.1 error[E0308]: mismatched types --> /Users/myusername/.cargo/registry/src/github.com-1ecc6299db9ec823/one2html-1.1.1/src/utils.rs:12:41 | 12 | let _state = happylog::set_progress(&bar); | ---------------------- ^^^^ expected struct `indicatif::progress_bar::ProgressBar`, found struct `ProgressBar` | | | arguments to this function are incorrect | = note: struct `ProgressBar` and struct `indicatif::progress_bar::ProgressBar` have similar names, but are actually distinct types note: struct `ProgressBar` is defined in crate `indicatif` --> /Users/myusername/.cargo/registry/src/github.com-1ecc6299db9ec823/indicatif-0.16.2/src/progress_bar.rs:23:1 | 23 | pub struct ProgressBar { | ^^^^^^^^^^^^^^^^^^^^^^ note: struct `indicatif::progress_bar::ProgressBar` is defined in crate `indicatif` --> /Users/myusername/.cargo/registry/src/github.com-1ecc6299db9ec823/indicatif-0.17.3/src/progress_bar.rs:21:1 | 21 | pub struct ProgressBar { | ^^^^^^^^^^^^^^^^^^^^^^ = note: perhaps two different versions of crate `indicatif` are being used? note: function defined here --> /Users/myusername/.cargo/registry/src/github.com-1ecc6299db9ec823/happylog-0.2.0/src/console_emitter.rs:93:8 | 93 | pub fn set_progress(pb: &ProgressBar) -> LogPBState { | ^^^^^^^^^^^^
For more information about this error, try
rustc --explain E0308
.
error: could not compileone2html
due to previous error
error: failed to compileone2html v1.1.1
, intermediate artifacts can be found at/var/folders/4_/6kk1zdsj72zbhg5rk8z8tnfr0000gn/T/cargo-installn065ME
This occurred on stable v1.66.1 (cargo install --no-default-features one2html
) and v1.69.0-nightly (cargo +nightly install one2html
).
I would like the ability to open a OneNote section file from an in memory buffer such a slice of u8's.
For context, my project is a malware scanner that recursively extracts files and scans the content. Our scanner typically opens the file to access the contents before parsing with various parsers. I'm working on adding support for extracting attachments from OneNote sections and leveraging your library for handling newer style OneNote section files.
I have a PoC working and will submit a PR in a moment.
E.g. for embedded YouTube videos etc.
The latest version of the OneNote web app apparently inserts images without a "last modified" time or the parser parses this property incorrectly, which causes a failure when parsing the downloaded .one
file with this crate.
The error I am encountering is: Malformed OneNote file data: image has no last modified time
which seems to originate from image_node.rs#L50
It might be better to make this property fall back to the epoch or something like that?
Thanks for writing this crate!
Edit: after applying this fix in my fork I am stumbling over more and more issues. The last modified
property doesn't exist/doesn't get parsed correctly for any objects in the file and I am also getting an Malformed OneNote data: paragraph styling is missing
Error for rich text objects. Probably more to come when that is resolved.
I am not sure if an incompatible break in the file format happened or if the parsing is not robust enough in certain cases.
I am unable to compile the project.
OS: Debian testing
rustc: 1.56.0
Error message:
error[E0308]: mismatched types
--> src/reader.rs:44:9
|
43 | pub(crate) fn bytes(&self) -> &[u8] {
| ----- expected `&[u8]` because of return type
44 | self.0.bytes()
| ^^^^^^^^^^^^^^ expected `&[u8]`, found struct `std::io::Bytes`
|
= note: expected reference `&[u8]`
found struct `std::io::Bytes<&[u8]>`
For more information about this error, try `rustc --explain E0308`.
error: could not compile `onenote_parser` due to previous error
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.