[GH-ISSUE #969] remote edit bug #566

Closed
opened 2026-02-26 23:59:59 +03:00 by kerem · 3 comments
Owner

Originally created by @blue-bird1 on GitHub (Dec 1, 2018).
Original GitHub issue: https://github.com/electerm/electerm/issues/969

Electerm version:

0.25.41

Operating system(linux, macos, or windows?):

windows

Expected Behavior

not error info

Current Behavior

show some error info (but it actually it may have no effect, because it is wrong in checkfileexist)

Possible Solution

Steps to Reproduce

1.edit remote file
2.input some info, make componentDidUpdate And enteringrebuildState
3.
4.

Context (Environment)

Detailed Description

I thought that this should not happen after viewing the source code, but I met magically.

Uncaught (in promise) TypeError: Cannot read property 'replace' of null
    at Ua.N [as checkFileExist] (electerm.0.25.41-afcdbeaab0acaea38d20bddea0694b007d80934d.js:9)
    at Ua.N [as rebuildState] (electerm.0.25.41-afcdbeaab0acaea38d20bddea0694b007d80934d.js:9)
    at Ua.componentDidUpdate (electerm.0.25.41-afcdbeaab0acaea38d20bddea0694b007d80934d.js:9)
    at Bc (react-dom.production.min.js?0.25.41-afcdbeaab0acaea38d20bddea0694b007d80934d:145)
    at yc (react-dom.production.min.js?0.25.41-afcdbeaab0acaea38d20bddea0694b007d80934d:136)
    at R (react-dom.production.min.js?0.25.41-afcdbeaab0acaea38d20bddea0694b007d80934d:135)
    at eg (react-dom.production.min.js?0.25.41-afcdbeaab0acaea38d20bddea0694b007d80934d:133)
    at ab (react-dom.production.min.js?0.25.41-afcdbeaab0acaea38d20bddea0694b007d80934d:131)
    at Object.enqueueSetState (react-dom.production.min.js?0.25.41-afcdbeaab0acaea38d20bddea0694b007d80934d:192)
    at _o.r.setState (react.production.min.js?0.25.41-afcdbeaab0acaea38d20bddea0694b007d80934d:20)

In fact its error line is the source code

app in getBasepath try get targetTransferPath and srcTransferPath. but it is null.
Then try to call basePath.replace(/\\/g, '\\\\'). Null not have replace method . get a error

I check this.props.

files:Array(1) # I edit file
srcTransferPath:null
srcTransferType:null
targetTransferPath:null
targetTransferType:null
transferType:null

I in getTransferProps break point not trigger. but if I uplaod a file trigger. The error will disappear

Suggestions?

It seems that you didn't fill these fields when editing the file, and it unexpectedly triggered this code.

Originally created by @blue-bird1 on GitHub (Dec 1, 2018). Original GitHub issue: https://github.com/electerm/electerm/issues/969 <!--- Provide some basic info --> ## Electerm version: 0.25.41 ## Operating system(linux, macos, or windows?): windows ## Expected Behavior <!--- Tell me what should happen --> not error info ## Current Behavior <!--- Tell me what happens instead of the expected behavior --> show some error info (but it actually it may have no effect, because it is wrong in `checkfileexist`) ## Possible Solution <!--- Not obligatory, but suggest a fix/reason for the bug, --> ## Steps to Reproduce <!--- Provide a link to a live example, or an unambiguous set of steps to --> <!--- reproduce this bug. Include code to reproduce, if relevant --> 1.edit remote file 2.input some info, make `componentDidUpdate` And entering`rebuildState` 3. 4. ## Context (Environment) <!--- How has this issue affected you? What are you trying to accomplish? --> <!--- Providing context helps us come up with a solution that is most useful in the real world --> ## Detailed Description <!--- Provide a detailed description of the change or addition you are proposing --> I thought that this should not happen after viewing the source code, but I met magically. ``` Uncaught (in promise) TypeError: Cannot read property 'replace' of null at Ua.N [as checkFileExist] (electerm.0.25.41-afcdbeaab0acaea38d20bddea0694b007d80934d.js:9) at Ua.N [as rebuildState] (electerm.0.25.41-afcdbeaab0acaea38d20bddea0694b007d80934d.js:9) at Ua.componentDidUpdate (electerm.0.25.41-afcdbeaab0acaea38d20bddea0694b007d80934d.js:9) at Bc (react-dom.production.min.js?0.25.41-afcdbeaab0acaea38d20bddea0694b007d80934d:145) at yc (react-dom.production.min.js?0.25.41-afcdbeaab0acaea38d20bddea0694b007d80934d:136) at R (react-dom.production.min.js?0.25.41-afcdbeaab0acaea38d20bddea0694b007d80934d:135) at eg (react-dom.production.min.js?0.25.41-afcdbeaab0acaea38d20bddea0694b007d80934d:133) at ab (react-dom.production.min.js?0.25.41-afcdbeaab0acaea38d20bddea0694b007d80934d:131) at Object.enqueueSetState (react-dom.production.min.js?0.25.41-afcdbeaab0acaea38d20bddea0694b007d80934d:192) at _o.r.setState (react.production.min.js?0.25.41-afcdbeaab0acaea38d20bddea0694b007d80934d:20) ``` In fact its error line is the [source code](https://github.com/electerm/electerm/blob/36a4011fbcec743ca6ce8e26de66fe87e64b811f/src/client/components/sftp/confirm-list.jsx#L387) app in [getBasepath](https://github.com/electerm/electerm/blob/36a4011fbcec743ca6ce8e26de66fe87e64b811f/src/client/components/sftp/confirm-list.jsx#L98:3` ) try get `targetTransferPath` and ` srcTransferPath`. but it is `null`. Then try to call ` basePath.replace(/\\/g, '\\\\')`. `Null` not have `replace` method . get a error I check `this.props`. ``` files:Array(1) # I edit file srcTransferPath:null srcTransferType:null targetTransferPath:null targetTransferType:null transferType:null ``` I in `getTransferProps` break point not trigger. but if I uplaod a file trigger. The error will disappear ## Suggestions? <!--- Not a bug report, just some thoughts or suggestions? It is totally OK and welcome too --> It seems that you didn't fill these fields when editing the file, and it unexpectedly triggered this code.
kerem 2026-02-26 23:59:59 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@zxdong262 commented on GitHub (Dec 3, 2018):

How to reproduce this bug, can you provide more detail?

<!-- gh-comment-id:443742519 --> @zxdong262 commented on GitHub (Dec 3, 2018): How to reproduce this bug, can you provide more detail?
Author
Owner

@blue-bird1 commented on GitHub (Dec 3, 2018):

I am not very sure, but it seems to be related to closing the editor without using the cancel button

<!-- gh-comment-id:443839992 --> @blue-bird1 commented on GitHub (Dec 3, 2018): I am not very sure, but it seems to be related to closing the editor without using the cancel button
Author
Owner

@zxdong262 commented on GitHub (Dec 4, 2018):

@blue-bird1 I know it now, press enter triggers the error.

<!-- gh-comment-id:443987316 --> @zxdong262 commented on GitHub (Dec 4, 2018): @blue-bird1 I know it now, press enter triggers the error.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/electerm#566
No description provided.