Klipper3d / klipper

Klipper is a 3d-printer firmware
GNU General Public License v3.0
8.99k stars 5.17k forks source link

fix virtual SD file position count #6469

Closed zxy16305 closed 5 months ago

zxy16305 commented 5 months ago

The resume process begins at self.current_file.seek(self.file_position), where self.file_position represents a byte-length offset. However, file_position is incremented by len(line), which corresponds to the string length. If there are any UTF-8 characters preceding the 'PAUSE' command, the resumed file position must be set before the occurrence of 'PAUSE'.

To address this issue, replacing the string length with the byte length is sufficient.

KevinOConnor commented 5 months ago

Thanks. Seems fine to me. Commits need to have a signed-off-by line for me to commit directly though - see: https://www.klipper3d.org/CONTRIBUTING.html

-Kevin

zxy16305 commented 5 months ago

Thank you! I'll close this pull request and open another one at https://github.com/Klipper3d/klipper/pull/6472