mirror of
https://github.com/balena-io/etcher.git
synced 2025-04-24 15:27:17 +00:00
fix(writer): Use final size if it's not an estimation (#1587)
This avoids running into the "flashstate percentage above 100%" error again. Change-Type: patch Changelog-Entry: Prevent "percentage above 100%" errors on DMG images.
This commit is contained in:
parent
fa8f8151f6
commit
36664fb251
@ -157,7 +157,9 @@ module.exports = {
|
||||
extension: fileExtensions.getLastFileExtension(imagePath),
|
||||
stream: udif.createReadStream(imagePath),
|
||||
size: {
|
||||
original: options.size,
|
||||
// FIXME(jhermsmeier): Originally `options.size`,
|
||||
// See discussion in https://github.com/resin-io/etcher/pull/1587
|
||||
original: size || options.size,
|
||||
final: {
|
||||
estimation: false,
|
||||
value: size
|
||||
|
@ -81,14 +81,13 @@ describe('ImageStream: DMG', function() {
|
||||
it('should return the correct metadata', function() {
|
||||
const image = path.join(DMG_PATH, 'etcher-test-zlib.dmg');
|
||||
const uncompressedSize = fs.statSync(path.join(IMAGES_PATH, 'etcher-test.img')).size;
|
||||
const compressedSize = fs.statSync(image).size;
|
||||
|
||||
return imageStream.getImageMetadata(image).then((metadata) => {
|
||||
m.chai.expect(metadata).to.deep.equal({
|
||||
path: image,
|
||||
extension: 'dmg',
|
||||
size: {
|
||||
original: compressedSize,
|
||||
original: uncompressedSize,
|
||||
final: {
|
||||
estimation: false,
|
||||
value: uncompressedSize
|
||||
@ -122,14 +121,13 @@ describe('ImageStream: DMG', function() {
|
||||
it('should return the correct metadata', function() {
|
||||
const image = path.join(DMG_PATH, 'etcher-test-raw.dmg');
|
||||
const uncompressedSize = fs.statSync(path.join(IMAGES_PATH, 'etcher-test.img')).size;
|
||||
const compressedSize = fs.statSync(image).size;
|
||||
|
||||
return imageStream.getImageMetadata(image).then((metadata) => {
|
||||
m.chai.expect(metadata).to.deep.equal({
|
||||
path: image,
|
||||
extension: 'dmg',
|
||||
size: {
|
||||
original: compressedSize,
|
||||
original: uncompressedSize,
|
||||
final: {
|
||||
estimation: false,
|
||||
value: uncompressedSize
|
||||
|
Loading…
x
Reference in New Issue
Block a user